alarm() is emulated on Windows.  It works at the Perl level, but it doesn’t interrupt while you are executing XS code, and it will also not terminate blocking system calls.

 

There is no way to abort an OLE call short of terminating the process as far as I can tell. The only exception would be objects that provide an event mechanism and periodically poll the caller to see if they should abort the long running operation or not.

 

Cheers,-Jan

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of D D Allen
Sent: April 25, 2006 12:46 PM
To: [email protected]
Subject: So is 'alarm' implemented under Win32?

 


I feel like I'm asking a dumb question.... but is 'alarm' implemented under Win32 in ActiveState Perl 5.8.8 build 817?

When I try to use the alarm function from Time::HiRes, I receive the following...

Time::HiRes::alarm(): unimplemented in this platform at pmpmark.pl line 112.
        ...propagated at pmpmark.pl line 117.


When I use the built-in alarm function (not from Time::HiRes), it just doesn't seem to work.

        eval {
                local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
                alarm(30);
                $loginseconds = ClickFormButton('Submit');  #OLE call to IE
                alarm(0);
      };
      if ($@) {
              die unless $@ eq "alarm\n";   # propagate unexpected errors
                # timed out
               
                print "login timeout\n";
                #  more stuff
        }

The ActivePerl documentation says that alarm is unimplemented which would explain why it doesn't work.

But I think I've seen / used Perl modules under Win32 that implement a timeout function...

But this 2+ year old message to / from perl5-porters seems to indicate that alarm is implemented under ActiveState Perl 5.8 and above.

http://aspn.activestate.com/ASPN/Mail/Message/perl5-porters/1915044

And then I found this from Jan Dubois from 3+ years ago.  So maybe alarm minimally works -- but it won't break out of an Win32 OLE call...

http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-users/1547759


So maybe the better question is:  Is there anyway to implement an alarm like function under Win32 that will break out of a long running Win32 OLE call?


Regards,

... Dewey

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to