Due to the thread procedure trying to access the shared variable res directly. 
In Nim thread procedures can't capture variables by closure as it may lead to 
unsafe memory access. However, since res is of type Atomic[int], which is safe 
for concurrent access, you can work around this by-passing res as a parameter 
to the thread procedure.

Reply via email to