Add wait-for-pid to unix.process (till we have something better)
parent
72dcf7fe61
commit
225692f144
|
@ -27,4 +27,15 @@ IN: unix.process
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: with-fork ( child parent -- ) fork dup zero? -roll swap curry if ; inline
|
: 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" <c-object> WNOHANG waitpid
|
||||||
|
0 = [ 100 sleep wait-for-pid ] [ drop ] if ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue