Keep track of which thread-local contexts have been initialized
authorVincent Pit <vince@profvince.com>
Tue, 31 Mar 2015 19:15:40 +0000 (16:15 -0300)
committerVincent Pit <vince@profvince.com>
Tue, 31 Mar 2015 19:24:07 +0000 (16:24 -0300)
commit0b3fd3ca50b788eb9ba7b9a1a3fbdb2266d6a40f
tree369ab26ea275dbcbb5d73a9de3a8c9358d93ed2a
parent66fbc02a67af759ab45aef7e8c6ac5d659551311
Keep track of which thread-local contexts have been initialized

If you have two threads that are run in parallel, and the the module is
first loaded in one and then in the other, then our check functions might
be called in the second thread before the module's boot function is
executed. This is bad because the boot function is needed to initialize the
thread-local context, and this context is needed by the check functions.

To fix this, we keep track of which contexts were initialized thanks to a
refcounted pointer table.
indirect.xs