[fpc-pascal] AllocateThreadVars ?

Sven Barth pascaldragon at googlemail.com
Thu Oct 10 14:06:46 CEST 2024


Adriaan van Os via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mi., 9. Okt. 2024, 16:44:

> I have a program on MacOS that calls CoreAudio which calls the application
> back in a so-called
> AURendererCallback in a separate (com.apple.audio.IOThread.client) thread.
> This is a pthread
> created by the system software, not by the FreePascal RTL.
>
> In that thread, a FreePascal try except block doesn't catch an exception.
> A globally installed
> TExceptProc does. if I look in the RTL code, it looks like a thread
> created with BeginThread does
> some extra things, like calling SysAllocateThreadVars. A comment notes
> that exception handling
> depends on it.
>
> So, it seems plausible that SysAllocateThreadVars (or the
> AllocateThreadVars method of the current
> TThreadManager) must be called once for  pthreads created by the system
> software ? How ? Obviously
> I couldn't use a threadvar that tells me whether AllocateThreadVars has
> been called already ?
>

You already wrote that you might have found a different cause, but
nevertheless to clarify: the RTL initialization for the thread (which
includes AllocateThreadVars) should already be done transparently by the
RTL through hooks provided by pthread.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20241010/53f78cbf/attachment.htm>


More information about the fpc-pascal mailing list