sleep binding
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ikarus Scheme |
Fix Committed
|
Wishlist
|
Abdulaziz Ghuloum |
Bug Description
this is a feature request.
a way to pause the runtime would be very useful!
attached is a binding to the posix nanosleep function that could perhaps be a starting point?
regards,
rohan
=== modified file 'scheme/
--- scheme/
+++ scheme/
@@ -16,10 +16,12 @@
(library (ikarus system time-and-date)
(export current-time time? time-second time-nanosecond
- time-gmt-offset)
+ time-gmt-offset
+ nanosleep)
(import
(except (ikarus) time current-time time? time-second
- time-nanosecond time-gmt-offset))
+ time-nanosecond time-gmt-offset
+ nanosleep))
(define-struct time (msecs secs usecs))
@@ -42,5 +44,9 @@
(if (time? x)
(die 'time-gmt-offset "not a time" x)))
+
+ (define (nanosleep s ns)
+ (foreign-call "ikrt_nanosleep" s ns))
+
)
=== modified file 'scheme/
--- scheme/makefile.ss 2008-03-23 09:02:12 +0000
+++ scheme/makefile.ss 2008-04-02 07:32:21 +0000
@@ -382,6 +382,7 @@
[time-second i]
[time-
[time-
+ [nanosleep i]
[command-
[set-
[make-
=== modified file 'src/ikarus-
--- src/ikarus-
+++ src/ikarus-
@@ -877,6 +877,16 @@
*/
}
+ikptr
+ikrt_nanosleep
+ struct timespec ts;
+ int err;
+ ts.tv_sec = (time_t)unfix(s);
+ ts.tv_nsec = (long)unfix(ns);
+ err = nanosleep(&ts, NULL);
+ return (fix(err));
+}
+
ikptr
ikrt_fork(){
int pid = fork();
Related branches
Changed in ikarus: | |
milestone: | none → 0.0.4 |
Will do.