Glad you found a solution!

3) I'm also convinced now that there is indeed a subtle bug in the gcc pthread 
implementation for the mips4 architecture; a scoped_shared_lock as in 
handle_data() in sink.cpp can sometimes make the shared_lock try_to_lock in 
process() fail, which should not happen.
doesn't that follow from 1)?

So I decided to avoid the try_to_lock shared reader lock in process() for 
sink.cpp and source.cpp and converted it to a write_guard (RAII) / generation 
counter (keeping all the other write and read locks the same, just for that 
reader trylock).
Can you tell me more about that write_guard / generation counter? How does it work?

Christof

On 8/12/2026 12:41 AM, Wolfgang Gaggl via Pd-list wrote:
Finally, I found a good solution for this trylock issue.
It appears that there are a few things going on platform and compiler dependent:
1) In Irix, trylock does not guarantee a lock on the first try by design even 
if uncontested as mentioned in my previous post; trying it a few times can fix 
that
2) It appears that trylock can take a bit longer depending on what the system 
is doing at the time. Context switching is expensive for this architecture, I 
observed that to be even more unpredictable on the Origin than the Octane, 
since the NUMA bus and page/cache migration between node boards add layers of 
complexity. This can increase the time to obtain a lock.
3) I'm also convinced now that there is indeed a subtle bug in the gcc pthread 
implementation for the mips4 architecture; a scoped_shared_lock as in 
handle_data() in sink.cpp can sometimes make the shared_lock try_to_lock in 
process() fail, which should not happen. And these are very busy, so any lock 
failures are eventually converted into xruns.

So I decided to avoid the try_to_lock shared reader lock in process() for 
sink.cpp and source.cpp and converted it to a write_guard (RAII) / generation 
counter (keeping all the other write and read locks the same, just for that 
reader trylock). It works really well since this lock is not contested usually, 
no looping needed, no apparent performance expense.

I'm really happy with AOO for PD on SGI Irix now!
---
[email protected] - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/4ZIU4SQPNYQGO25ORB7KJFMMHRCZYWZT/

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/2HYTBMVKINADEE67F6NGP3EWNNOFNW5M/

To unsubscribe send an email to [email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.iem.at/

Reply via email to