--- a/UnixOperatingSystem.st Thu May 28 14:22:10 2015 +0200
+++ b/UnixOperatingSystem.st Thu May 28 14:55:12 2015 +0200
@@ -10079,6 +10079,43 @@
"
!
+microsecondSleep:micros
+ "cease ANY action for some time.
+ This suspends the whole smalltalk (unix/windows-) process for some time.
+ Not really useful since not even low-prio processes and interrupt
+ handling will run during the sleep.
+ Use either OperatingSystem>>millisecondDelay: (which makes all
+ threads sleep, but handles interrupts) or use a Delay
+ (which makes only the calling thread sleep)."
+
+ |uLow uHigh|
+
+ uLow := micros // 1000000.
+ uHigh := micros \\ 1000000.
+%{
+ struct timeval tv;
+ fd_set dummy;
+ int success;
+
+ int s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+ FD_ZERO(&dummy);
+ FD_SET(s, &dummy);
+ tv.tv_sec = __intVal(uLow);
+ tv.tv_usec = __intVal(uHigh);
+ success = (0 == select(0, 0, 0, &dummy, &tv));
+ close(s);
+ RETURN (success ? true : false);
+%}
+
+ "
+ Timestamp now printCR.
+ OperatingSystem microsecondSleep:100.
+ Timestamp now printCR.
+ "
+
+ "Created: / 28-05-2015 / 14:14:53 / gg"
+!
+
sleep:numberOfSeconds
"{ Pragma: +optSpace }"
@@ -14429,11 +14466,11 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.441 2015-05-24 12:52:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.442 2015-05-28 12:55:12 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.441 2015-05-24 12:52:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.442 2015-05-28 12:55:12 cg Exp $'
! !