> On Oct 30, 2022, at 6:55 PM, Marco van de Voort via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> Yes. They call pthread_detach when ending, i.e. just before calling 
> pthread_exit. So if you use normal threads, you already use that.
> 
> Similarly, pthread_join is a part of tthread.waitfor .  Have a look at 
> rtl/unix/cthreads.pp for how the RTL threads map to pthreads on *nix systems.

Ok I see that now in cthreads.pp. Do you need to call EndThread from the thread 
callback when calling BeginThread? I thought the thread cleaned itself up when 
the function terminated but I may be wrong about that. Pthreads at least 
doesn’t appear to require you to detach the thread but maybe it’s leaking 
memory then.

Regards,
Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to