Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: alarm() on windows 2003, overview

by EdwardG (Vicar)
on Feb 01, 2006 at 10:03 UTC ( #527007=note: print w/ replies, xml ) Need Help??


in reply to alarm() on windows 2003, overview

Looking at the ActiveState sources, it seems 5.8.3 had the first Win32 implementation of alarm(). Here's the changelog comment -

[ 21901] By: nicholas on 2003/12/13 21:22:15 Log: Integrate: ... [ 21895] alarm() is now implemented on Win32. ...

And from looking inside win32.c it seems that win32_alarm() uses SetTimer.

And yes, the behaviour of SetTimer has changed from Win 2000 to Win 2003

On 2000 if the timeout "is greater than USER_TIMER_MAXIMUM, the timeout is set to 1."

On 2003 SP1 if the timeout "is greater than USER_TIMER_MAXIMUM, the timeout is set to USER_TIMER_MAXIMUM."

That might be your problem, maybe.

 


Comment on Re: alarm() on windows 2003, overview
Select or Download Code
Re^2: alarm() on windows 2003, overview
by Anonymous Monk on Feb 02, 2006 at 19:18 UTC
    15.7.1. Problem You want to sound an alarm on the user's terminal.
    15.7.2. Solution Print the "\a" character to sound a bell: print "\aWake up!\n"; Or use the "vb" terminal capability to show a visual bell: use Term::Cap; $OSPEED = 9600; eval { require POSIX; my $termios = POSIX::Termios->new( ); $termios->getattr; $OSPEED = $termios->getospeed; }; $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED}); $vb = ""; eval { $terminal->Trequire("vb"); $vb = $terminal->Tputs('vb', 1); }; print $vb; # ring visual bell 15.7.3. Discussion The "\a" escape is the same as "\cG", "\007", and "\x07". They all cor +respond to the ASCII BEL character and cause an irritating ding. In a + crowded terminal room at the end of the semester, this beeping cause +d by dozens of vi novices all trying to get out of insert mode at onc +e can be maddening. The visual bell is a workaround to avoid irritati +on. Based upon the polite principle that terminals should be seen and + not heard (at least, not in crowded rooms), some terminals let you b +riefly reverse the foreground and background colors to give a flash o +f light instead of an audible ring. Not every terminal supports the visual bell, which is why we eval the +code that finds it. If the terminal doesn't support it, Trequire will + die without having changed the value of $vb from "". If the terminal + does support it, the value of $vb will be set to the character seque +nce to flash the bell. There's a better approach to the bell issue in graphical terminal syst +ems like xterm. Many of these let you enable the visual bell from the + enclosing application itself, allowing all programs that blindly out +put a chr(7) to become less noisy.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://527007]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-07-05 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls