Thanks for checking!
So I wrote a test that does an exclusive write lock/unlock and a couple of
concurrent shared reader locks, it worked when just run without repetition.
When repeating it a thousand times, I started to see once in a while when it
seemingly randomly missed to get a reader lock.
I'm not sure I understand your test case. When you grab an exclusive
lock, it is expected that you can't get a shared lock concurrently. What
you should do instead is repeatedly obtaining short reader try-locks
from several threads and see if any of them fail.
If that test still fails, it confirms our shared suspicion that it is a
bug in the MIPS pthread implementation. (I'm pretty sure
std::shared_mutext just uses pthread_rw_lock under the hood. If you have
time, you can try to verify that.)
Christof
On 7/21/2026 12:28 AM, Wolfgang Gaggl via Pd-list wrote:
I checked, AOO_HAVE_PTHREAD_RWLOCK is set true.
I also intentionally failed this test to get mutex implementation, same
behavior (maybe a bit worse in performance).
So I wrote a test that does an exclusive write lock/unlock and a couple of
concurrent shared reader locks, it worked when just run without repetition.
When repeating it a thousand times, I started to see once in a while when it
seemingly randomly missed to get a reader lock.
This looks like a bug in the newer GCC pthread implementation for legacy MIPS
(needed for C++11/17).
Atomics and locks work with the native MIPSpro compiler, which however can only
do C99/C++98.
The workaround above works because if it misses that shared lock once in many
executions only, a repeat try catches it without adding much computational
overhead.
Maybe I find a better solution at some point, or some platform specific
compiler flag optimization that improve/fix it.
Thanks for your debug suggestions!
---
[email protected] - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/O4T6IFNXJAOC2ESOQ7DGKTT6H73RDUPY/
To unsubscribe send an email to [email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.iem.at/
---
[email protected] - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/UDZ2ED7KZ2Y5C4453QU2WLM5IDB2WMOR/
To unsubscribe send an email to [email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.iem.at/