sumim #731(2007/07/13 09:09 GMT) [ Smalltalk ] Rating0/0=0.00
OSProcess インストール済みの Squeak Smalltalk で。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| pipe1 pipe2 procA procB semaA semaB | OSProcess accessor canAccessSystem ifFalse: [^self]. pipe1 := OSPipe nonBlockingPipe. pipe2 := OSPipe nonBlockingPipe. procA := UnixProcess forkJob: 'a' arguments: nil environment: nil descriptors: {pipe1 reader. pipe2 writer. nil}. procB := UnixProcess forkJob: 'b' arguments: nil environment: nil descriptors: {pipe2 reader. pipe1 writer. nil}. semaA := Semaphore new. semaB := Semaphore new. [[Processor yield. procA isComplete] whileFalse. procB sigterm. semaA signal] fork. [[Processor yield. procB isComplete] whileFalse. procA sigterm. semaB signal] fork. semaA wait. semaB wait. pipe1 close. pipe2 close
Rating0/0=0.00-0+
[ reply ]
sumim
#731()
[
Smalltalk
]
Rating0/0=0.00
| pipe1 pipe2 procA procB semaA semaB | OSProcess accessor canAccessSystem ifFalse: [^self]. pipe1 := OSPipe nonBlockingPipe. pipe2 := OSPipe nonBlockingPipe. procA := UnixProcess forkJob: 'a' arguments: nil environment: nil descriptors: {pipe1 reader. pipe2 writer. nil}. procB := UnixProcess forkJob: 'b' arguments: nil environment: nil descriptors: {pipe2 reader. pipe1 writer. nil}. semaA := Semaphore new. semaB := Semaphore new. [[Processor yield. procA isComplete] whileFalse. procB sigterm. semaA signal] fork. [[Processor yield. procB isComplete] whileFalse. procA sigterm. semaB signal] fork. semaA wait. semaB wait. pipe1 close. pipe2 closeRating0/0=0.00-0+
[ reply ]