[PD-dev] Improving portability of the thread management

Pierre Guillot guillotpierre6 at gmail.com
Sun Apr 24 16:20:05 CEST 2016

PD uses the pthread library, but with MVC this can be really annoying. The
project pthread-win32 offers a dynamic version of the library for Windows
but no static version. If you compile the static library, you have to
change the code because there are linking problems with MVC. I think it
would be better to use Windows thread system. The main problem comes from
the file "d_soundfile.c". I made a small wrapper (
https://github.com/pierreguillot/thread) and if you're interested I can try
to integrate this in PD. I have several questions before. Should I use a
wrapper for pthread and "WinThread" or should I make a wrapper only for
WinThread that allows to use the pthread function prototypes. I already
have the two solutions. I don't know if the sys_lock/sys_unlock/sys_trylock
functions (in m_sched.c) are really necessary in a context like libpd. The
problem is that we can't have a static initializer for Windows critical
sections, so we must use something like void sys_lock_init and
sys_lock_destroy. For the moment, in my project I use the preprocessor
definition THREAD_LOCKING=0 to avoid this part of the code but I think it
would be better to enable this feature, in case someone uses it in an

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20160424/094087b9/attachment.html>

More information about the Pd-dev mailing list