Thanks for the helgrind example. I'll have to add that to my toolkit.

[https://linux.die.net/man/3/fork](https://linux.die.net/man/3/fork)

> A process shall be created with a single thread. If a multi-threaded process 
> calls fork(), the new process shall contain a replica of the calling thread 
> and its entire address space, possibly including the states of mutexes and 
> other resources...
    
    
    import threadpool
    
    when isMainModule:
      quit(QUITSUCCESS)
    

Running strace, I noticed that there were 12 clone syscalls made.

In nim/lib/pure/concurrency/threadpool.nim, setup is called in the main body 
and creates a worker for each processor.

I think this explains why the mutex is not properly cleared as we are forking 
from a multi-threaded process that is setup by threadpool.nim.

Reply via email to