From 225692f14498202d5720ed5481ffec044e1557a9 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Thu, 15 Nov 2007 17:49:43 -0600 Subject: [PATCH] Add wait-for-pid to unix.process (till we have something better) --- extra/unix/process/process.factor | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/extra/unix/process/process.factor b/extra/unix/process/process.factor index fac95eabaa..7f06f903ac 100644 --- a/extra/unix/process/process.factor +++ b/extra/unix/process/process.factor @@ -27,4 +27,15 @@ IN: unix.process ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: with-fork ( child parent -- ) fork dup zero? -roll swap curry if ; inline \ No newline at end of file +: with-fork ( child parent -- ) fork dup zero? -roll swap curry if ; inline + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +! This is kludgy. We need a better implementation. + +USE: threads + +: wait-for-pid ( pid -- ) + dup "int" WNOHANG waitpid + 0 = [ 100 sleep wait-for-pid ] [ drop ] if ; +