Improper locking bugs due to the unrelesed locks before destorying
Hi, developers, thank you for your checking! Should the lock be released before destroying it(Line 158 and 164)? According to this, it says It shall be safe to destroy an initialized mutex that is unlocked.
https://github.com/HaxeFoundation/neko/blob/1df580cb95e6f93d71d553391a92eda2fab283dd/vm/threads.c#L150-L165
Also, it seems the lock(Line 154) would be released by the thread(Line 117), is my understanding correct? If so, I think the attribute of mutex should be set to pthread_mutexattr_setpshared to enable this:
The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a mutex to be operated upon by any thread that has access to the memory where the mutex is allocated, even if the mutex is allocated in memory that is shared by multiple processes.
https://github.com/HaxeFoundation/neko/blob/1df580cb95e6f93d71d553391a92eda2fab283dd/vm/threads.c#L110-L124
Thank you for your checking! Looking forward to the discussion.