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