Permalink
Browse files

Properly attributed Matt Sergeant (not Scott Beck) for IO::Poll

support.  Fixed the bug that Ted Suzman reported in Kernel.pm's
SIGCHLD handling.  True processes return positive PIDs, which were
being treated as inconsistencies in POE::Kernel.  Added a regression
test for this condition.
----------------------------------------------------------------------
----------------------------------------------------------------------
  • Loading branch information...
1 parent da6a2f2 commit 6b023cd48a17e4e82ddb501fc7200057cecc7b4a @rcaputo committed Jun 2, 2002
Showing with 49 additions and 0 deletions.
  1. +1 −0 MANIFEST
  2. +48 −0 tests/28_windows.t
View
@@ -107,3 +107,4 @@ t/24_filter_stack.t
t/25_detach.t
t/26_comp_tcp.t
t/27_poll.t
+t/28_windows.t
View
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+# $Id$
+
+# Tests various signals using POE's stock signal handlers. These are
+# plain Perl signals, so mileage may vary.
+
+use strict;
+use lib qw(./lib ../lib);
+use TestSetup;
+
+&test_setup(1);
+
+# Turn on all asserts.
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+use POE;
+
+# POE::Kernel in version 0.19 assumed that SIGCHLD on Windows would
+# always return negative PIDs. This was only true for pseudo
+# processes created by fork(). Ted Suzman pointed out that real
+# processes, such as those created by open("foo|"), have positive
+# PIDs, so the internal inconsistency checks in POE were bogus. This
+# test generates a positive PID and ensures that it's not treated as
+# an error.
+
+POE::Session->create
+ ( inline_states =>
+ { _start => sub {
+ $_[KERNEL]->sig(CHLD => "child_handler");
+ $_[KERNEL]->delay(timeout => 2);
+ open(FOO, "echo foo > nul:|") or die $!;
+ open(FOO, "echo foo > nul:|") or die $!;
+ my @x = <FOO>;
+ },
+ child_handler => sub {
+ ok(1);
+ $_[KERNEL]->delay(timeout => undef);
+ },
+ _stop => sub { },
+ timeout => sub {
+ not_ok(1);
+ },
+ }
+ );
+
+$poe_kernel->run();
+results();
+close FOO;
+unlink "nul:";

0 comments on commit 6b023cd

Please sign in to comment.