[fpc-pascal] pthread_detach

Hairy Pixels genericptr at gmail.com
Sun Oct 30 13:05:16 CET 2022



> On Oct 30, 2022, at 6:55 PM, Marco van de Voort via fpc-pascal <fpc-pascal at 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



More information about the fpc-pascal mailing list