[PD] lock free problem

Miller Puckette msp at ucsd.edu
Tue Aug 23 18:13:32 CEST 2016


There's a good, byte-stream lock-free fifo in pd/src/s_audio_paring.c .
(It's borrowed from portaudio).  The difficulty there would be the necessity
of encoding everything into byte streams.  Perhaps just sprintf/sscanf will
do it for you.

cheers
Miller

On Tue, Aug 23, 2016 at 03:49:20PM +0200, Marco Matteo Markidis wrote:
> Dear all,
> 
> I'm developing an external that has two threads, one audio thread and one
> worker thread. The audio thread contains all usual stuff; while the worker
> thread computes calculations (I need knn searches and so on for my
> resynthesis) and put them in a data structure. At the end of calculations,
> the worker thread atomically CAS the data structure.
> Actually, I'm using a [readsf~]-like mechanics with pthread signal to
> communicate between threads.
> 
> I would like to remove lock and use a lock free system. I don't know if it
> feasible. Moreover I don't know if it has some sense, because Pd locks a
> mutex in scheduler and I don't know if a lock free implementation could be
> a right solution.
> 
> In the case it could be a solution, I will start with a SPSC circular queue
> and I will use atomic CAS to swap the data structure.
> 
> Best regards,
> 
> Marco

> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list




More information about the Pd-list mailing list