develooper Front page | perl.perl5.porters | Postings from July 2000

fix and question re: waitpid() under win32

Thread Next
From:
Brian Clarke
Date:
July 28, 2000 12:12
Subject:
fix and question re: waitpid() under win32
Message ID:
3981DC85.290314EB@appliedmeta.com
So there are two issues:
1) win32_waitpid() in win32.c was unable to perform a nonblocking wait,
primarily due to:
2) WNOHANG not defined under win32.

Under Linux, WNOHANG is #defined to 1, so in reality you could probably
just check the flags arg against 1.  However, in the interest of
readability (if nothing else) I chose to #define WNOHANG 1 if it wasn't
already defined at the beginning of win32.c  You can then just set a
timeout value (0 or INFINITE) based on flags&WNOHANG.  Of course, you
must then check the return code for both WAIT_TIMEOUT in addition to
WAIT_FAILED.

I've included a patch to implement this.  I don't really like the
#define WNOHANG 1, but it's that or check against the constant 1...

			-Brian

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Brian Clarke
Applied MetaComputing LLC
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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