diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -13,6 +13,7 @@ import ( "runtime" "runtime/cgo" "strings" + "sync" "time" _ "github.com/mattn/go-sqlite3" @@ -341,6 +342,8 @@ func main() { module["http"] = httpModule module["db"] = dbModule + wg := sync.WaitGroup{} + wg.Add(*wrksNum) // start workers for i := 0; i < *wrksNum; i++ { wrk := NewWorker() @@ -352,10 +355,12 @@ func main() { } wrks = append(wrks, wrk) log.Printf("worker %d started\n", i) + wg.Add(-1) wrk.Listen(msgs) }() defer wrk.Stop() } + wg.Wait() // listen for evals from stdio go func () { |
