summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-11-15 18:47:34 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-11-15 18:47:34 +0000
commit8d5630125a4c2a8f0b9bf3e77e79c546fb5c5a6d (patch)
tree79a2007970c37d708bda25ae6ece44fe373dfcd4 /pp_sys.c
parentce2f7c3be671853dd8e435baa8ec8d4453b3bb86 (diff)
downloadperl-8d5630125a4c2a8f0b9bf3e77e79c546fb5c5a6d.tar.gz
add a synchronous stub fork() for USE_ITHREADS to prove that a simple
C<if (fork()) { print "parent" } else { print "child" }> works on Windows (incidentally running a cloned^2 interpreter :) p4raw-id: //depot/perl@4589
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index b2495a06dc..ebc5e2776c 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3582,7 +3582,22 @@ PP(pp_fork)
PUSHi(childpid);
RETURN;
#else
+# ifdef USE_ITHREADS
+ /* XXXXXX testing */
+ djSP; dTARGET;
+ /* XXX this just an approximation of what will eventually be run
+ * in a different thread */
+ PerlInterpreter *new_perl = perl_clone(my_perl, 0);
+ Perl_pp_enter(new_perl);
+ new_perl->Top = new_perl->Top->op_next; /* continue from next op */
+ CALLRUNOPS(new_perl);
+
+ /* parent returns with negative pseudo-pid */
+ PUSHi(-1);
+ RETURN;
+# else
DIE(aTHX_ PL_no_func, "Unsupported function fork");
+# endif
#endif
}