[armedbear-devel] Pure threads and hashtables test
alanruttenberg at gmail.com
Fri Sep 27 18:13:29 UTC 2013
Agreed. While the gethash and puthash should independently work, the combination of the two isn't thread safe. For example two processes could get the value in the ht before either has a chance to write back the increment.
However, since the combination of the two is a common pattern, it would certainly be useful to have an easy to use function that guaranteed the whole update was synchronized.
In any case, that is why I chose to use the keys. Each key for a result is unique so there shouldn't be any contention over key/value pair.
I'm going to so some more tests to see whether the problem is generic or related to the regex call.
I think all the variables I use in the processing lambda are thread local but I will have another look there. Um, just as a sanity check, allocation of space for the closures are thread safe, right?
On Fri, Sep 27, 2013 at 8:27 AM, Mark Evenson <evenson at panix.com> wrote:
> Eh. Upon reflection, not entirely sure that the increments are happening CV correctly. I will try to move the test to counting the total entries in the hash table, rather than only accessing one key. This should be closer to Alan's original problem.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the armedbear-devel