equal
deleted
inserted
replaced
20 OperatingSystem comment:' |
20 OperatingSystem comment:' |
21 |
21 |
22 COPYRIGHT (c) 1988 by Claus Gittinger |
22 COPYRIGHT (c) 1988 by Claus Gittinger |
23 All Rights Reserved |
23 All Rights Reserved |
24 |
24 |
25 $Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.10 1994-01-12 19:11:58 claus Exp $ |
25 $Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.11 1994-02-05 12:27:58 claus Exp $ |
26 |
26 |
27 written 1988 by claus |
27 written 1988 by claus |
28 '! |
28 '! |
29 |
29 |
30 %{ |
30 %{ |
1188 Return first ready fd if i/o ok, nil if timed-out or interrupted. |
1188 Return first ready fd if i/o ok, nil if timed-out or interrupted. |
1189 Experimental." |
1189 Experimental." |
1190 |
1190 |
1191 |rcount wcount ecount| |
1191 |rcount wcount ecount| |
1192 |
1192 |
1193 (readFdArray isNil or:[readFdArray class == Array]) ifFalse:[ |
1193 (readFdArray notNil and:[readFdArray class ~~ Array]) ifTrue:[ |
1194 ^ self error:'argument must be an Array' |
1194 ^ self error:'argument must be nil or an Array' |
1195 ]. |
1195 ]. |
1196 (writeFdArray isNil or:[writeFdArray class == Array]) ifFalse:[ |
1196 (writeFdArray notNil and:[writeFdArray class ~~ Array]) ifTrue:[ |
1197 ^ self error:'argument must be an Array' |
1197 ^ self error:'argument must be nil or an Array' |
1198 ]. |
1198 ]. |
1199 (errorFdArray isNil or:[errorFdArray class == Array]) ifFalse:[ |
1199 (errorFdArray notNil and:[errorFdArray class ~~ Array]) ifTrue:[ |
1200 ^ self error:'argument must be an Array' |
1200 ^ self error:'argument must be nil or an Array' |
1201 ]. |
1201 ]. |
1202 rcount := readFdArray size. |
1202 rcount := readFdArray size. |
1203 wcount := writeFdArray size. |
1203 wcount := writeFdArray size. |
1204 ecount := errorFdArray size. |
1204 ecount := errorFdArray size. |
1205 %{ |
1205 %{ |
1211 if (_isSmallInteger(millis)) { |
1211 if (_isSmallInteger(millis)) { |
1212 FD_ZERO(&rset); |
1212 FD_ZERO(&rset); |
1213 FD_ZERO(&wset); |
1213 FD_ZERO(&wset); |
1214 FD_ZERO(&eset); |
1214 FD_ZERO(&eset); |
1215 |
1215 |
1216 maxF = 0; |
1216 maxF = -1; |
1217 for (i=0; i<_intVal(rcount);i++) { |
1217 for (i=0; i<_intVal(rcount);i++) { |
1218 fd = _ArrayInstPtr(readFdArray)->a_element[i]; |
1218 fd = _ArrayInstPtr(readFdArray)->a_element[i]; |
1219 if (fd != nil) { |
1219 if (fd != nil) { |
1220 f = _intVal(fd); |
1220 f = _intVal(fd); |
1221 if ((f >= 0) && (f < FD_SETSIZE)) { |
1221 if ((f >= 0) && (f < FD_SETSIZE)) { |
1245 } |
1245 } |
1246 } |
1246 } |
1247 t = _intVal(millis); |
1247 t = _intVal(millis); |
1248 wt.tv_sec = t / 1000; |
1248 wt.tv_sec = t / 1000; |
1249 wt.tv_usec = (t % 1000) * 1000; |
1249 wt.tv_usec = (t % 1000) * 1000; |
|
1250 |
1250 if (select(maxF+1, &rset, &wset, &eset, &wt)) { |
1251 if (select(maxF+1, &rset, &wset, &eset, &wt)) { |
1251 for (i=0; i <= maxF; i++) { |
1252 for (i=0; i <= maxF; i++) { |
1252 if (FD_ISSET(i, &rset) |
1253 if (FD_ISSET(i, &rset) |
1253 || FD_ISSET(i, &wset) |
1254 || FD_ISSET(i, &wset) |
1254 || FD_ISSET(i, &eset)) { |
1255 || FD_ISSET(i, &eset)) { |