[fpc-devel]promised tthread patch
Johannes Berg
johannes at sipsolutions.com
Mon Nov 17 01:35:56 CET 2003
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)
Have fun! :)
I consider this pretty good to use, but the signal issue blocks it.
johannes
--
http://www.sipsolutions.de/
GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc
Key-ID: 9AB78CA5 Johannes Berg <johannes at sipsolutions.de>
Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thread.patch
Type: text/x-patch
Size: 17766 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20031117/46d5191b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20031117/46d5191b/attachment.sig>
More information about the fpc-devel
mailing list