2 use Config qw(%Config);
\r
6 my $fork_emulation = $Config{ccflags} =~ /PERL_IMPLICIT_SYS/;
\r
8 my $tests = $fork_emulation ? 4 : 2;
\r
9 plan tests => $tests;
\r
11 my $pid = $$+0; # make sure we don't copy any magic to $pid
\r
13 if ($^O eq "cygwin") {
\r
14 skip(!defined &Cygwin::pid_to_winpid,
\r
15 Cygwin::pid_to_winpid($pid),
\r
16 Win32::GetCurrentProcessId());
\r
19 ok($pid, Win32::GetCurrentProcessId());
\r
22 if ($fork_emulation) {
\r
23 # This test relies on the implementation detail that the fork() emulation
\r
24 # uses the negative value of the thread id as a pseudo process id.
\r
25 if (my $child = fork) {
\r
29 ok(-$$, Win32::GetCurrentThreadId());
\r
31 # GetCurrentProcessId() should still return the real PID
\r
32 ok($pid, Win32::GetCurrentProcessId());
\r
33 ok($$ != Win32::GetCurrentProcessId());
\r
36 # here we just want to see something.
\r
37 ok(Win32::GetCurrentThreadId() > 0);
\r