mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: re-enable concurrency and fix the counter example (#10484)
This commit is contained in:
@ -9,6 +9,11 @@ const (
|
||||
|
||||
struct App {
|
||||
vweb.Context
|
||||
mut:
|
||||
state shared State
|
||||
}
|
||||
|
||||
struct State {
|
||||
mut:
|
||||
cnt int
|
||||
}
|
||||
@ -29,9 +34,10 @@ pub fn (mut app App) user_endpoint(user string) vweb.Result {
|
||||
}
|
||||
|
||||
pub fn (mut app App) index() vweb.Result {
|
||||
app.cnt++
|
||||
lock app.state {
|
||||
app.state.cnt++
|
||||
}
|
||||
show := true
|
||||
// app.text('Hello world from vweb')
|
||||
hello := 'Hello world from vweb'
|
||||
numbers := [1, 2, 3]
|
||||
app.enable_chunked_transfer(40)
|
||||
|
Reference in New Issue
Block a user