ruricolist / serapeum

Utilities beyond Alexandria
MIT License
420 stars 41 forks source link

Static-let and thread count #115

Closed ruricolist closed 2 years ago

ruricolist commented 2 years ago

Currently the flush functions for static-let make the assumption that it is enough to check if there is only one thread to make sure there is no other code running. This is true of SBCL, but not (at least) of Clozure: Clozure running in a terminal always has at least two threads.

Currently I've set the check only to be run if there are actually static bindings to flush, but it may be best to just remove it. @phoe, what do you think?

phoe commented 2 years ago

Welp, that is an optimistic assumption I have made.

I guess we can remove the check after slapping a big fat warning onto the flushing functions' documentation strings that they are not thread-safe whatsoever and that stopping all other threads that might access these bindings is the programmer's job.

Either that or we maintain an implementation-defined list of threads that are "harmless" and do not run application code, and we remove them from (bt:all-threads) before checking how many threads are left.