I've refactored ThreadMap a little to get rid of thread_local variables. This is required to support version of clang shipped with XCode to fix #1 issue reported by @eljobe.
Also reference counting guards were added to ThreadMap to prevent heap corruption when get and remove for the same JNIenv happen simultaneously.
Map (readers) is truly signal safe now (it assumes that atomics are lock-free as circular_queue does). I've placed lookup code to signal handler to speedup search.
I've done some changes to memory ordering in circular_queue to make it as relaxed as possible.
Improved 64 bit hashing function, since previous one was a complete disaster and almost all JNIenv's were hashed to the same bucket....
I've refactored ThreadMap a little to get rid of
thread_local
variables. This is required to support version of clang shipped with XCode to fix #1 issue reported by @eljobe.Also reference counting guards were added to
ThreadMap
to prevent heap corruption whenget
andremove
for the sameJNIenv
happen simultaneously.