$Bill Luebkert <> wrote:
> Brian Raven wrote:
>> 
>> I don't think I was suggesting that Perl's alarm function works
>> identically on Win32 and Unix, that certainly wasn't my intention. My
>> main points were that the alarm function does exist on Win32 Perl,
>> and 
> 
> And my point was that it probably won't work on Win32.  Pointing out
> that alarm exists, doesn't solve the problem of using it. 

Sorry $Bill, perhaps I am not making myself clear. I was not pointing
out that alarm exists for the purpose of solving the OP's problem, but
simply to counter your statement that it didn't exist.

> 
>> even if you were using Unix it probably isn't appropriate for a
>> multithreaded environment, both of which are contrary to what you
>> wrote. 
> 
> I've never used Perl on UNIX in a threaded env but knowing UNIX in
> the past quite well, I doubt that true threads would hinder alarms. 
> UNIX just doesn't do stupid things like that in their implementation.
> Either you would get one alarm per task and have to determine which
> thread to process it in or you would get one alarm per thread which
> would be much more useful.     
> 
> The one threaded UNIX I have used is SunOS and signals would be
> available by thread in that env.  You could have one thread field the
> alarm signal and use another signal to then signal the correct thread
> that wants the interrupt (basically multiplex the alarm signal).   

Perhaps you should check the man page for alarm. I have just checked the
Solaris 5.8 man page and it clearly says that there is only one timer
per process. It also says that if you call alarm from a bound thread,
using the Solaris threads library, that the signal will be delivered to
that thread. However, it also says that that behaviour is buggy, and is
about to be replaced by the standard (POSIX threads) behaviour of
delivering the signal to the process, which is also the case if you use
the pthreads library.

So, you can only have one timer active, and you can't guarantee which
thread the SIGALRM will be delivered to (unless you have set up your
thread signal masks appropriately), which isn't much use if you want
'timeout' functionality in multiple threads.

Sorry $Bill, but just to make it clear, I am just countering your
statement "so if you're on UNIX you'll be fine", which I don't believe
to be true. I have done a fair bit of multithreaded programming on a
number of platforms, and the general consensus seems to be that signals
in a multithreaded environment should be avoided, indeed, some go as far
as to say they are evil.

HTH




=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to