develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #16807] getting alarm() to work within threads

From:
Elizabeth Mattijsen
Date:
February 6, 2003 07:53
Subject:
Re: [perl #16807] getting alarm() to work within threads
Message ID:
p05111b09ba6834bd56a7@[192.168.0.3]
At 15:42 +0000 2/6/03, Jarkko Hietaniemi (via RT) wrote:
>I must point out that saying "getting alarm() to work with threads" is very
>similar to saying "getting TNT to work with Semtex".  Signals and threads
>are rather poorly mixing concepts, some things are defined in standards
>about the interaction but what is defined is usually pretty unhelpful, like
>for example that the when a signal arrives IT MAY ARRIVE AT ANY THREAD.

Too bad.  However, it does seem to work under Linux...  but that's 
only because threads are actually processes there, yes I know....


>The main thread, the thread who send the signal, ANY THREAD.
>In other words, I think we may be out of luck here.

This is really too bad, as there are particular applications that you 
would want to do parallelly with threads because of timeouts, such as 
resolving IP numbers.  In my experience, gethostbyaddr() can hang 
indefinitely (well, longer than I cared to wait anyway), which you 
would like to catch() with an alarm().

I guess I will need to spend some more time on forks.pm again...  ;-)


Liz



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About