From c76bdc7c63ed626767bd26545b40f87a63199fc3 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sun, 21 Jan 2018 13:27:22 +0100 Subject: [PATCH] Move "sleep" into chicken.time and add "process-sleep" to chicken.time.posix --- chicken.import.scm | 2 +- library.scm | 25 ++++++++++++------------- posix.scm | 2 +- scheduler.scm | 4 ++-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/chicken.import.scm b/chicken.import.scm index 24bc00a8..8d3f6b05 100644 --- a/chicken.import.scm +++ b/chicken.import.scm @@ -145,7 +145,7 @@ (setter . chicken.base#setter) (signal . chicken.condition#signal) (signum . chicken.base#signum) - sleep + (sleep . chicken.time#sleep) (software-type . chicken.platform#software-type) (software-version . chicken.platform#software-version) (string->uninterned-symbol . chicken.base#string->uninterned-symbol) diff --git a/library.scm b/library.scm index 992fdb9d..6059bd8d 100644 --- a/library.scm +++ b/library.scm @@ -40,7 +40,7 @@ +maximum-allowed-exponent+ mantexp->dbl ldexp round-quotient ##sys#string->compnum ##sys#internal-gcd) (not inline ##sys#change-directory-hook ##sys#user-read-hook - ##sys#error-hook ##sys#signal-hook ##sys#sleep-hook + ##sys#error-hook ##sys#signal-hook chicken.time#sleep-hook ##sys#default-read-info-hook ##sys#infix-list-hook ##sys#sharp-number-hook ##sys#user-print-hook ##sys#user-interrupt-hook ##sys#windows-platform @@ -1058,7 +1058,7 @@ EOF (##sys#setslot x i y) ) (module chicken.time - (cpu-time current-milliseconds current-seconds) + (cpu-time current-milliseconds current-seconds sleep) (import scheme) (import (only (chicken module) reexport)) @@ -1080,6 +1080,16 @@ EOF (##core#inline_allocate ("C_a_i_cpu_time" 8) buf) (values (##sys#slot buf 0) (##sys#slot buf 1)) )) )) +;;; Sleeping: + +(define (chicken.time#sleep-hook n) ; modified by scheduler.scm + (##core#inline "C_i_process_sleep" n)) + +(define (sleep n) + (##sys#check-fixnum n 'sleep) + (chicken.time#sleep-hook n) + (##core#undefined)) + ) ; chicken.time (define (##sys#check-structure x y . loc) @@ -5724,17 +5734,6 @@ EOF (thunk)) ; does nothing, will be modified by scheduler.scm -;;; Sleeping: - -(define (##sys#sleep-hook n) ; modified by scheduler.scm - (##core#inline "C_i_process_sleep" n)) - -(define (sleep n) - (##sys#check-fixnum n 'sleep) - (##sys#sleep-hook n) - (##core#undefined)) - - ;;; Interrupt-handling: (define ##sys#context-switch (##core#primitive "C_context_switch")) diff --git a/posix.scm b/posix.scm index fdd97dbb..0fe5341f 100644 --- a/posix.scm +++ b/posix.scm @@ -166,7 +166,7 @@ (module chicken.time.posix (seconds->utc-time utc-time->seconds seconds->local-time seconds->string local-time->seconds string->time time->string - local-timezone-abbreviation) + local-timezone-abbreviation process-sleep) (import chicken.posix)) (module chicken.process diff --git a/scheduler.scm b/scheduler.scm index cfb83306..c77dabf1 100644 --- a/scheduler.scm +++ b/scheduler.scm @@ -36,7 +36,7 @@ ; ##sys#force-primordial remove-from-ready-queue fdset-test create-fdset stderr delq ##sys#clear-i/o-state-for-thread! ##sys#abandon-mutexes) - (not inline ##sys#interrupt-hook ##sys#sleep-hook ##sys#force-primordial) + (not inline ##sys#interrupt-hook chicken.time#sleep-hook ##sys#force-primordial) (unsafe) (foreign-declare #<