<div dir="ltr"><div>Ok, for the moment my fake pthread API is a set of macro. It would be better that I clean a bit this part of the code. One way to use it would be to set up a preprocessor definition (something like WIN_USE_NATIVE_THREAD). This way, the devs must define explicitly the use of the Windows API. Nevertheless, I have to put this work on standby for the moment, I have got too much work to do and I don't want to introduce bugs because I rushed.</div><div>Thanks !</div><div>Pierre </div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-30 20:29 GMT+02:00 Miller Puckette <span dir="ltr"><<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">After thinking for a while about this I think it's best if you try to fake<br>
the cthreads API from the windows one...  if only because that way whatever<br>
bugs get introduced will only manifest when using the rarer windows API.<br>
(I live in fear of lurking thread-safety lapses which can cause crashes that<br>
are extremely hard to reproduce.)<br>
<br>
cheers<br>
Miller<br>
<div><div class="h5"><br>
On Sun, Apr 24, 2016 at 04:20:05PM +0200, Pierre Guillot wrote:<br>
> PD uses the pthread library, but with MVC this can be really annoying. The<br>
> project pthread-win32 offers a dynamic version of the library for Windows<br>
> but no static version. If you compile the static library, you have to<br>
> change the code because there are linking problems with MVC. I think it<br>
> would be better to use Windows thread system. The main problem comes from<br>
> the file "d_soundfile.c". I made a small wrapper (<br>
> <a href="https://github.com/pierreguillot/thread" rel="noreferrer" target="_blank">https://github.com/pierreguillot/thread</a>) and if you're interested I can try<br>
> to integrate this in PD. I have several questions before. Should I use a<br>
> wrapper for pthread and "WinThread" or should I make a wrapper only for<br>
> WinThread that allows to use the pthread function prototypes. I already<br>
> have the two solutions. I don't know if the sys_lock/sys_unlock/sys_trylock<br>
> functions (in m_sched.c) are really necessary in a context like libpd. The<br>
> problem is that we can't have a static initializer for Windows critical<br>
> sections, so we must use something like void sys_lock_init and<br>
> sys_lock_destroy. For the moment, in my project I use the preprocessor<br>
> definition THREAD_LOCKING=0 to avoid this part of the code but I think it<br>
> would be better to enable this feature, in case someone uses it in an<br>
> external.<br>
><br>
> Cheers<br>
<br>
</div></div>> _______________________________________________<br>
> Pd-dev mailing list<br>
> <a href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a><br>
> <a href="https://lists.puredata.info/listinfo/pd-dev" rel="noreferrer" target="_blank">https://lists.puredata.info/listinfo/pd-dev</a><br>
<br>
</blockquote></div><br></div>