File: signal.t

package info (click to toggle)
libevent-perl 1.28-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 776 kB
  • sloc: ansic: 3,035; perl: 1,122; makefile: 8
file content (41 lines) | stat: -rw-r--r-- 532 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# signal -*-perl-*-

BEGIN {
    if ($^O eq 'MSWin32') {
	print "1..0 # skipped; kill() doesn't send signals on Win32\n";
	exit;
    }
}

use Test; plan tests => 4;
use Event qw(loop unloop);

#$Event::DebugLevel = 3;

my $count = 3;

Event->signal(
    signal => 'USR1',
    cb =>
	sub {
	    my $e = shift;

	    ok $e->w->signal, 'USR1';
	    ok $e->hits > 0;  # threads can cause signal clumping

	    unloop;
	}
);

my $idle;
$idle = Event->idle(
    cb => sub {
	kill 'USR1',$$;
	kill 'USR1',$$;
	ok 1;
    }
);

loop;

ok 1;