Hello,
I was wondering if there was a pragma to restrict the use of some procedures to the main thread.
The use case I have is that I did some bindings of the glibc DNS resolution procedures in the resolv nimble, and I believe that the glibc procedures are not thread safe. As such, I would like to restrict the nim procedures to a single thread only.
There is the {.gcsafe.} pragma that kind of does the opposite, but it's tied to the garbage collector that's going away. And I want to specifically mark a procedure not thread safe.
Perhaps if that does not exists, it could be a nice small addition.
You can use code like this:
var mainThread = getThreadId()
proc foobar =
## This needs to be called by the main thread:
assert getThreadId() == mainThread