top | item 44241641

(no title)

j_seigh | 8 months ago

You just need to keep track of each thread's quiescent states however they are implemented.

discuss

order

kccqzy|8 months ago

Right but isn't that difficult to implement in a library?

j_seigh|8 months ago

Thread local vars would be used with lazy initialization. Clean up might be a little tricky depending on what implementation of thread local you use. Thread local support is not as great as it should be.

cryptonector|8 months ago

Not really. https://github.com/nicowilliams/ctp is mine -- the API is not RCU, but a simpler and easier to use "thread-safe variable" construct. You'll find two C implementations there. I've been using this in production for almost a decade without any trouble. (For a long time I had a missing producer membar in the create primitive (oops!), but because it only happens once it never caused me any problems.)

To be fair I thought about it for a long time first. But nowadays these techniques are well known, so now it's easier to "copy" the thinking others have done, and that thinking is the hard part.