Add a helper for initializing fsStdOut in threads

This commit is contained in:
Zahary Karadjov 2020-11-27 19:32:04 +02:00
commit 4f6c874c10
No known key found for this signature in database
GPG key ID: C8936F8A3073D609

View file

@ -1,5 +1,13 @@
import
outputs
let fsStdOut* {.threadvar.} = fileOutput(system.stdout)
var fsStdOut* {.threadvar.}: OutputStream
proc initFsStdOut* =
## This proc must be called in each thread where
## the `fsStdOut` variable will be used.
if fsStdOut == nil:
fsStdOut = fileOutput(system.stdout)
initFsStdOut()