Synchronizing native threads with reader/writer locks at Android NDK