File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 9
9
10
10
struct App {
11
11
vweb.Context
12
+ mut :
13
+ state shared State
14
+ }
15
+
16
+ struct State {
12
17
mut :
13
18
cnt int
14
19
}
@@ -29,9 +34,10 @@ pub fn (mut app App) user_endpoint(user string) vweb.Result {
29
34
}
30
35
31
36
pub fn (mut app App) index () vweb.Result {
32
- app.cnt++
37
+ lock app.state {
38
+ app.state.cnt++
39
+ }
33
40
show := true
34
- // app.text('Hello world from vweb')
35
41
hello := 'Hello world from vweb'
36
42
numbers := [1 , 2 , 3 ]
37
43
app.enable_chunked_transfer (40 )
Original file line number Diff line number Diff line change @@ -334,7 +334,7 @@ pub fn run<T>(global_app &T, port int) {
334
334
// conn: 0
335
335
// }
336
336
mut conn := l.accept () or { panic ('accept() failed' ) }
337
- handle_conn <T >(mut conn, mut request_app)
337
+ go handle_conn <T >(mut conn, mut request_app)
338
338
}
339
339
}
340
340
You can’t perform that action at this time.
0 commit comments