Add wait-for-pid to unix.process (till we have something better)

release
Eduardo Cavazos 2007-11-15 17:49:43 -06:00
parent 72dcf7fe61
commit 225692f144
1 changed files with 12 additions and 1 deletions

View File

@ -28,3 +28,14 @@ IN: unix.process
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: 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 ;