[fpc-devel]promised tthread patch
Michael Van Canneyt
michael.vancanneyt at wisa.be
Mon Nov 17 09:29:29 CET 2003
On Mon, 17 Nov 2003, Johannes Berg wrote:
> Hi,
>
> Attached is a new version, this time with the diff of classesh.inc
>
> This one contains the following new features:
> * calling suspend from within threads is possible
> and properly supported
> * exceptions now work (I accidentally forgot AcquireExceptionObject)
> * a thread trying to free itself yields an exception
> (if it propagates up completely the FreeOnTerminate flag is set and
> the thread destroyed none-the-less)
> * factored out code for synchronization because I want to use
> semaphores as they don't fill up the file descriptor table, not used
> yet because they are not available in classes.pp (yet?), so still
> uses a pipe
> * moved FThreadID to protected visibility in case someone needs to use
> the base pthread_* functions on the thread
> - the pipe thing is most likely not signal safe (recv can be
> interrupted). I'm pretty sure actually, but need to test that and
> add loops as appropriate.
> - still no synchronization support. I don't think this is too hard, but
> need information on how the foreground thread should be notified. A
> pipe would work well, the foreground thread could select() it and see
> if any thread wants it to do work for it (I expect that the GUI app
> main loop already selects anyway)
Delphi needs you to explicitly insert calls to CheckSynchronize. This is
handled in the main loop of Delphi applications, and if you don't use
that (e.g. no forms), then no synchronization is performed. I discovered
that the hard way.
I'll look into implementing it.
Michael.
More information about the fpc-devel
mailing list