
perlbug-followup at perl
Apr 30, 2012, 8:56 AM
Post #2 of 4
(91 views)
Permalink
|
|
[perl #24892] alarm not working with Windows XP
[In reply to]
|
|
On Sun Apr 29 18:20:57 2012, Hugmeir wrote: > I just built Perl on WinXP, and while this is still present, perlport's > note of alarm() somewhat explains what's going on. But in any case, > could a Windows porter take a look at this? ntdll.dll!_KiFastSystemCallRet@0() ntdll.dll!_ZwRequestWaitReplyPort [at] 1() + 0xc ntdll.dll!_CsrClientCallServer [at] 1() + 0x57 kernel32.dll!_ReadConsoleInternal [at] 3() + 0x1c8 kernel32.dll!_ReadConsoleA [at] 2() + 0x3b kernel32.dll!_ReadFile [at] 2() + 0xa5 > msvcr71.dll!_read_lk(int fh=0, void * buf=0x00834074, unsigned int cnt=4096) Line 154 + 0x15 C msvcr71.dll!_read(int fh=0, void * buf=0x00834074, unsigned int cnt=4096) Line 75 + 0xc C perl512.dll!win32_read(int fd=0, void * buf=0x00834074, unsigned int cnt=4096) Line 3746 + 0x12 C perl512.dll!PerlLIORead(IPerlLIO * piPerl=0x00285dbc, int handle=0, void * buffer=0x00834074, unsigned int count=4096) Line 1049 + 0x11 C++ perl512.dll!PerlIOUnix_read(interpreter * my_perl=0x003940dc, _PerlIO * * f=0x00823474, void * vbuf=0x00834074, unsigned int count=4096) Line 2671 + 0x22 C perl512.dll!Perl_PerlIO_read(interpreter * my_perl=0x003940dc, _PerlIO * * f=0x00823474, void * vbuf=0x00834074, unsigned int count=4096) Line 1627 + 0x3e C perl512.dll!PerlIOBuf_fill(interpreter * my_perl=0x003940dc, _PerlIO * * f=0x008232f8) Line 3882 + 0x1b C perl512.dll!Perl_PerlIO_fill(interpreter * my_perl=0x003940dc, _PerlIO * * f=0x008232f8) Line 1723 + 0x36 C perl512.dll!PerlIOBase_read(interpreter * my_perl=0x003940dc, _PerlIO * * f=0x008232f8, void * vbuf=0x0006d92b, unsigned int count=1) Line 2131 + 0xd C perl512.dll!PerlIOBuf_read(interpreter * my_perl=0x003940dc, _PerlIO * * f=0x008232f8, void * vbuf=0x0006d92b, unsigned int count=1) Line 3903 + 0x15 C perl512.dll!Perl_PerlIO_read(interpreter * my_perl=0x003940dc, _PerlIO * * f=0x008232f8, void * vbuf=0x0006d92b, unsigned int count=1) Line 1627 + 0x3e C perl512.dll!PerlIO_getc(_PerlIO * * f=0x008232f8) Line 5081 + 0x13 C perl512.dll!Perl_sv_gets(interpreter * my_perl=0x003940dc, sv * const sv=0x0082bd2c, _PerlIO * * const fp=0x008232f8, long append=0) Line 7196 + 0x9 C perl512.dll!Perl_do_readline(interpreter * my_perl=0x003940dc) Line 1675 + 0x15 C perl512.dll!Perl_pp_readline(interpreter * my_perl=0x003940dc) Line 323 + 0x9 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=1) Line 2308 + 0xd C perl512.dll!perl_run(interpreter * my_perl=0x003940dc) Line 2233 + 0xd C perl512.dll!RunPerl(int argc=2, char * * argv=0x00282510, char * * env=0x002828f0) Line 270 + 0x9 C++ perl.exe!main(int argc=2, char * * argv=0x00282510, char * * env=0x00282d40) Line 23 + 0x12 C perl.exe!mainCRTStartup() Line 398 + 0xe C kernel32.dll!_BaseProcessStart@4() + 0x23 The console is synchronous IO. OS calls can not be interrupted. There is no concept of signals on Windows except for "Alertable IO"(TM). Whatever the fix, it won't be through the CRT. PeekConsoleInput http://msdn.microsoft.com/en-us/library/windows/desktop/ms684344%28v=vs.85%29.aspx might be related. Quickly thinking over it, the only way to implement alarm on windows for IO is perform all IO as async IO but with WaitForSingleObjectEx (alertable on), and a alertable timer SetWaitableTimer http://msdn.microsoft.com/en-us/library/windows/desktop/ms686289%28v=vs.85%29.aspx to create the alarm interrupt. Or just use WFSO on the async file handle with the timer on WFSO set to the alarm interval. It is absolutely possible. The alertable way I described above is probably how Interix does it. --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=24892
|