Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
e5777ecb
by Raymond Toy at 2016-11-28T20:29:33-08:00
-
05585b8d
by Raymond Toy at 2016-11-28T21:05:02-08:00
-
9e99edb8
by Raymond Toy at 2016-11-28T21:14:27-08:00
-
f09db6e5
by Raymond Toy at 2016-11-28T22:14:26-08:00
-
1aae3ef9
by Raymond Toy at 2016-11-29T19:01:54-08:00
-
260c0e45
by Raymond Toy at 2016-11-29T19:03:17-08:00
-
fb864a9b
by Raymond Toy at 2016-11-30T19:53:44-08:00
-
8743d581
by Raymond Toy at 2016-11-30T19:53:57-08:00
-
5f7c4fea
by Raymond Toy at 2016-12-02T03:37:16+00:00
5 changed files:
- src/code/lispinit.lisp
- src/code/multi-proc.lisp
- src/lisp/Config.sparc_common
- src/lisp/os-common.c
- tests/issues.lisp
Changes:
... | ... | @@ -515,12 +515,9 @@ |
515 | 515 |
:format-arguments (list n)
|
516 | 516 |
:datum n
|
517 | 517 |
:expected-type '(real 0)))
|
518 |
(multiple-value-bind (sec usec)
|
|
519 |
(if (integerp n)
|
|
520 |
(values n 0)
|
|
521 |
(multiple-value-bind (sec frac) (truncate n)
|
|
522 |
(values sec (truncate frac 1e-6))))
|
|
523 |
(unix:unix-select 0 0 0 0 sec usec))
|
|
518 |
(alien:alien-funcall
|
|
519 |
(alien:extern-alien "os_sleep" (function c-call:void double-float))
|
|
520 |
(float n 1d0))
|
|
524 | 521 |
nil)
|
525 | 522 |
|
526 | 523 |
;;;; SCRUB-CONTROL-STACK
|
... | ... | @@ -1643,12 +1643,9 @@ |
1643 | 1643 |
;; Can't call process-wait if the scheduling is inhibited.
|
1644 | 1644 |
*inhibit-scheduling*)
|
1645 | 1645 |
;; The initial-process may block.
|
1646 |
(multiple-value-bind (sec usec)
|
|
1647 |
(if (integerp n)
|
|
1648 |
(values n 0)
|
|
1649 |
(multiple-value-bind (sec frac)(truncate n)
|
|
1650 |
(values sec (truncate frac 1e-6))))
|
|
1651 |
(unix:unix-select 0 0 0 0 sec usec))
|
|
1646 |
(alien:alien-funcall
|
|
1647 |
(alien:extern-alien "os_sleep" (function c-call:void double-float))
|
|
1648 |
(float n 1d0))
|
|
1652 | 1649 |
nil)
|
1653 | 1650 |
(t
|
1654 | 1651 |
(process-wait-with-timeout "Sleep" n (constantly nil)))))
|
... | ... | @@ -48,5 +48,5 @@ ARCH_SRC = sparc-arch.c |
48 | 48 |
|
49 | 49 |
DEPEND=$(CC)
|
50 | 50 |
OS_SRC = solaris-os.c os-common.c elf.c
|
51 |
OS_LIBS= -lsocket -lnsl -ldl
|
|
51 |
OS_LIBS= -lsocket -lnsl -ldl -lrt
|
|
52 | 52 |
EXEC_FINAL_OBJ = exec-final.o
|
... | ... | @@ -6,9 +6,11 @@ |
6 | 6 |
*/
|
7 | 7 |
|
8 | 8 |
#include <errno.h>
|
9 |
#include <math.h>
|
|
9 | 10 |
#include <netdb.h>
|
10 | 11 |
#include <stdio.h>
|
11 | 12 |
#include <string.h>
|
13 |
#include <time.h>
|
|
12 | 14 |
|
13 | 15 |
#include "os.h"
|
14 | 16 |
#include "internals.h"
|
... | ... | @@ -562,3 +564,27 @@ int ieee754_rem_pio2(double x, double *y0, double *y1) |
562 | 564 |
|
563 | 565 |
return n;
|
564 | 566 |
}
|
567 |
|
|
568 |
/*
|
|
569 |
* sleep for the given number of seconds, even if we're interrupted.
|
|
570 |
*/
|
|
571 |
void
|
|
572 |
os_sleep(double seconds)
|
|
573 |
{
|
|
574 |
struct timespec requested;
|
|
575 |
struct timespec remaining;
|
|
576 |
double integral;
|
|
577 |
double fractional;
|
|
578 |
|
|
579 |
fractional = modf(seconds, &integral);
|
|
580 |
requested.tv_sec = (time_t) integral;
|
|
581 |
/*
|
|
582 |
* Round up---better to sleep slightly too long than to sleep for
|
|
583 |
* too short a time.
|
|
584 |
*/
|
|
585 |
requested.tv_nsec = (long) ceil(fractional * 1e9);
|
|
586 |
|
|
587 |
while (nanosleep(&requested, &remaining) == -1 && errno == EINTR) {
|
|
588 |
requested = remaining;
|
|
589 |
}
|
|
590 |
}
|
... | ... | @@ -352,3 +352,18 @@ |
352 | 352 |
(:tag :issues)
|
353 | 353 |
(loop for k from 1 to 24 do
|
354 | 354 |
(assert-equal 0 (encode-universal-time 0 0 (- 24 k) 31 12 1899 k))))
|
355 |
|
|
356 |
(define-test issue.26
|
|
357 |
(:tag :issues)
|
|
358 |
(let ((start-time (get-universal-time)))
|
|
359 |
(let ((p (ext:run-program "/usr/bin/env" '("sleep" "1") :wait nil)))
|
|
360 |
(sleep 5)
|
|
361 |
;; For this test to be valid, the process must have finished
|
|
362 |
;; with a successful exit.
|
|
363 |
(assert-true (eq (ext:process-status p) :exited))
|
|
364 |
(assert-true (zerop (ext:process-exit-code p)))
|
|
365 |
|
|
366 |
;; We expect to have slept for at least 5 sec, but since
|
|
367 |
;; get-universal-time only has an accuracy of 1 sec, just verify
|
|
368 |
;; more than 3 sec have elapsed.
|
|
369 |
(assert-true (>= (- (get-universal-time) start-time) 3)))))
|