]> gitweb.factorcode.org Git - factor.git/commitdiff
io.backend.unix: init-signal-pipe function
authorJoe Groff <arcata@gmail.com>
Tue, 8 Nov 2011 05:14:41 +0000 (21:14 -0800)
committerJoe Groff <arcata@gmail.com>
Tue, 8 Nov 2011 16:42:48 +0000 (08:42 -0800)
Currently just reads off signal numbers and drops them.

basis/io/backend/unix/unix.factor
core/kernel/kernel.factor

index 20799cbb4a84eb9c808f2c6e669a0639bbd118a0..96f0d21749d3f48fd94f3ec93a1f10e3228e30ae 100755 (executable)
@@ -187,6 +187,13 @@ M: stdin cancel-operation
         size-read-fd <fd> init-fd <input-port> >>size
         data-read-fd <fd> >>data ;
 
+: signal-pipe-fd ( -- n )
+    OBJ-SIGNAL-PIPE special-object { fixnum } declare ; inline
+
+: init-signal-pipe ( -- )
+    signal-pipe-fd <fd> init-fd <input-port>
+    '[ [ 4 _ io:stream-read ] loop ] "Signals" spawn drop ;
+
 M: unix init-stdio
     <stdin> <input-port>
     1 <fd> <output-port>
index 32cdb24b06ee7faed55cba6bbfbc5dda505c9160..a79e65c2b4711fbd7c581d8da4f06d101041fb80 100644 (file)
@@ -342,6 +342,8 @@ CONSTANT: OBJ-VM-COMPILER 72
 
 CONSTANT: OBJ-WAITING-CALLBACKS 73
 
+CONSTANT: OBJ-SIGNAL-PIPE 74
+
 ! Context object count and identifiers must be kept in sync with:
 !   vm/contexts.hpp