develooper Front page | perl.perl5.porters | Postings from April 2012

[perl #24892] alarm not working with Windows XP

Thread Previous | Thread Next
From:
bulk 88 via RT
Date:
April 30, 2012 12:26
Subject:
[perl #24892] alarm not working with Windows XP
Message ID:
rt-3.6.HEAD-4610-1335813969-1826.24892-15-0@perl.org
On Mon Apr 30 11:03:52 2012, ikegami@adaelis.com wrote:
> But why isn't the "signal" raised after readline returns?
You are making a good point. I dont know.

I modded the script to,
_____________________
$SIG{ALRM} = sub { die "Alarm!\n" };

alarm 2;
system("pause");

my $ans = <STDIN>;
chomp($ans);

print "No alarm.\n";
_____________________
I set a couple C breakpoints.
The WM_TIMER got processed not in runops async check but in pp_system's
async check. With the original script, with the same breakpoints, I
never saw a WM_TIMER.

 	perl512.dll!win32_message_window_proc(void * hwnd=0x00120ad0, unsigned
int msg=0x00000113, unsigned int wParam=0x00000001, long
lParam=0x00000000)  Line 4913	C
 	user32.dll!_InternalCallWinProc@20()  + 0x28	
 	user32.dll!_UserCallWinProcCheckWow@32()  + 0xb7	
 	user32.dll!_DispatchMessageWorker@8()  + 0xdc	
 	user32.dll!_DispatchMessageA@4()  + 0xf	
 	perl512.dll!win32_async_check(interpreter * my_perl=0x003940dc) 
Line 2150	C
>	perl512.dll!win32_msgwait(interpreter * my_perl=0x003940dc, unsigned
long count=0x00000001, void * * handles=0x0006f998, unsigned long
timeout=0xffffffff, unsigned long * resultp=0x00000000)  Line 2195 + 0x9	C
 	perl512.dll!win32_spawnvp(int mode=0x00000000, const char *
cmdname=0x00822f44, const char * const * argv=0x00822e6c)  Line 4249 +
0x19	C
 	perl512.dll!do_spawn2(interpreter * my_perl=0x003940dc, const char *
cmd=0x00832c74, int exectype=0x00000002)  Line 784 + 0x11	C
 	perl512.dll!Perl_do_spawn(interpreter * my_perl=0x003940dc, char *
cmd=0x00832c74)  Line 820 + 0xf	C
 	perl512.dll!Perl_pp_system(interpreter * my_perl=0x003940dc)  Line
4277 + 0x5e	C
 	perl512.dll!Perl_runops_debug(interpreter * my_perl=0x003940dc)  Line
2049 + 0xd	C
 	perl512.dll!S_run_body(interpreter * my_perl=0x003940dc, long
oldscope=0x00000001)  Line 2308 + 0xd	C
 	perl512.dll!perl_run(interpreter * my_perl=0x003940dc)  Line 2233 + 0xd	C
 	perl512.dll!RunPerl(int argc=0x00000002, char * * argv=0x00282510,
char * * env=0x002828f0)  Line 270 + 0x9	C++
 	perl.exe!main(int argc=0x00000002, char * * argv=0x00282510, char * *
env=0x00282d40)  Line 23 + 0x12	C
 	perl.exe!mainCRTStartup()  Line 398 + 0xe	C
 	kernel32.dll!_BaseProcessStart@4()  + 0x23	


I'm predicting right now the bug is that there is no way to tell perl to
check the Win32 Msg Queue by sending a message. The CRT signals run in a
separate CRT made thread, and set the sig_pending flag last I remember.


#define WIN32_POLL_INTERVAL 32768
#define PERL_ASYNC_CHECK() if (w32_do_async || PL_sig_pending)
win32_async_check(aTHX)
______________________
later
______________________
#define w32_do_async			(w32_poll_count++ > WIN32_POLL_INTERVAL)

I think this might be related to having to do 32K Perl OPs before a
WM_TIMER can be processed. I would have to do some testing to confirm
this. How to fix this? I propose switching to Kernel Timers
(CreateWaitableTimer) rather than GUI Timers and have the Kernel Timers
run in a separate OS thread and pretend to be CRT signals the way CRT
signals currently run (and cause race crashes on all perls see
https://rt.perl.org/rt3/Ticket/Display.html?id=101072 ).

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=24892

Thread Previous | Thread Next


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