diff options
| author | Andy Wingo <wingo@pobox.com> | 2017-01-08 14:15:25 +0100 |
|---|---|---|
| committer | Andy Wingo <wingo@pobox.com> | 2017-01-08 14:15:25 +0100 |
| commit | 1c4239af04ae16cbf6088192556425325cdc8e3a (patch) | |
| tree | 777d1f9ef65a5091596aa26bdba0dc8fd0fb235a | |
| parent | Web server uses dedicated fiber thread (diff) | |
| download | guile-fibers-1c4239af04ae16cbf6088192556425325cdc8e3a.tar.gz | |
Fix clock-nanosleep wrapper
* fibers/posix-clocks.scm (clock-nanosleep): clock_nanosleep returns
the error value directly; it doesn't set errno. Fix.
| -rw-r--r-- | fibers/posix-clocks.scm | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/fibers/posix-clocks.scm b/fibers/posix-clocks.scm index be7c323..dcdcf6d 100644 --- a/fibers/posix-clocks.scm +++ b/fibers/posix-clocks.scm @@ -114,16 +114,14 @@ (define clock-nanosleep (let* ((ptr (dynamic-pointer "clock_nanosleep" exe)) - (proc (pointer->procedure int ptr (list clockid-t int '* '*) - #:return-errno? #t))) + (proc (pointer->procedure int ptr (list clockid-t int '* '*)))) (lambda* (clockid nsec #:key absolute? (buf (nsec->timespec nsec))) - (let ((flags (if absolute? TIMER_ABSTIME 0))) - (call-with-values (lambda () (proc clockid flags buf buf)) - (lambda (ret errno) - (cond - ((zero? ret) (values #t 0)) - ((eqv? ret EINTR) (values #f (timespec->nsec buf))) - (else (error (strerror errno)))))))))) + (let* ((flags (if absolute? TIMER_ABSTIME 0)) + (ret (proc clockid flags buf buf))) + (cond + ((zero? ret) (values #t 0)) + ((eqv? ret EINTR) (values #f (timespec->nsec buf))) + (else (error (strerror ret)))))))) ;; Quick little test to determine the resolution of clock-nanosleep on ;; different clock types, and how much CPU that takes. Results on |
