Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-01

tthread.waitfor with timeout

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jorge Aldo G. de F. Junior

hi !

while working on my pascal actor model concurrency framework i hit a problem with the way tthread is currently implemented.

i need to quit all actors (threads) before closing the main application. this is done by waitfor/free each actor until none is left in the pool of locally running actors.

but sometimes an actor hangs, and waitfor will literally waitfor forever...

is there a way to do the equivalent of waifor but with some kind of timeout ?

thanks in advance,

J. Aldo

Jonas Maebe
to Jorge Aldo G. de F. Junior
Jorge Aldo G. de F. Junior wrote
is there a way to do the equivalent of waifor but with some kind of timeout ?

No. And at least the Unix pthreads library does not offer such an API, so it can't be added without some kind of emulation either (adding an extra event per thread or so to wait on -- but every thread already consumes quite a few extra such resources, and they should be kept to a minimum).

Jonas