-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thread safety #8
Comments
Hello @guinn8 indeed
|
Thanks @gpakosz! I got the array of mutexes working and it has massively increased performance. I did this by allocating an arbitrarily (!=
And then defined some functions to lock the mutex corresponding to a index in the underlying buffer (not the PackedArray index).
To make my life easier I decided to only support 32 divisible by
There is not reason this couldn't work for other bit sizes, I just don't need them so I didn't implement. I'm happy to push this code somewhere if there is interest :) |
Posting for the sake of others information. I attempted to use an array of mutexes to guard segments of a PackedArray to reduce the delay caused by threads waiting single-file to write to the PackedArray. This approach works fine with normal arrays. However with the PackedArray I was getting inconstant results.
This suggests that any invocation of the
PackedArray_get
/PackedArray_set
should be guarded by a mutex, even if the individual index is guarded.The text was updated successfully, but these errors were encountered: