diff --git a/include/cyclone/runtime.h b/include/cyclone/runtime.h index d7ec7d42..c08d4fad 100644 --- a/include/cyclone/runtime.h +++ b/include/cyclone/runtime.h @@ -233,7 +233,6 @@ extern const object primitive_Cyc_91cvar_127; extern const object primitive_Cyc_91has_91cycle_127; extern const object primitive_Cyc_91spawn_91thread_67; extern const object primitive_Cyc_91end_91thread_67; -extern const object primitive_thread_91sleep_67; extern const object primitive_Cyc_91minor_91gc; extern const object primitive__87; extern const object primitive__91; diff --git a/runtime.c b/runtime.c index df5d476b..a8c05a7b 100644 --- a/runtime.c +++ b/runtime.c @@ -1783,9 +1783,6 @@ void _Cyc_91spawn_91thread_67(void *data, object cont, object args) { void _Cyc_91end_91thread_67(void *data, object cont, object args) { Cyc_end_thread((gc_thread_data *)data); return_closcall1(data, cont, boolean_f); } -void _thread_91sleep_67(void *data, object cont, object args) { - Cyc_check_num_args(data, "thread-sleep!", 1, args); - return_closcall1(data, cont, Cyc_thread_sleep(data, car(args))); } void _Cyc_91minor_91gc_primitive(void *data, object cont, object args){ Cyc_trigger_minor_gc(data, cont); } void __87(void *data, object cont, object args) { @@ -2526,7 +2523,6 @@ static primitive_type Cyc_91cvar_127_primitive = {{0}, primitive_tag, "Cyc-cvar? static primitive_type Cyc_91has_91cycle_127_primitive = {{0}, primitive_tag, "Cyc-has-cycle?", &_Cyc_91has_91cycle_127}; static primitive_type Cyc_91spawn_91thread_67_primitive = {{0}, primitive_tag, "Cyc-spawn-thread!", &_Cyc_91spawn_91thread_67}; static primitive_type Cyc_91end_91thread_67_primitive = {{0}, primitive_tag, "Cyc-end-thread!", &_Cyc_91end_91thread_67}; -static primitive_type thread_91sleep_67_primitive = {{0}, primitive_tag, "thread-sleep!", &_thread_91sleep_67}; static primitive_type Cyc_91minor_91gc_primitive = {{0}, primitive_tag, "Cyc-minor-gc", &_Cyc_91minor_91gc_primitive}; static primitive_type _87_primitive = {{0}, primitive_tag, "+", &__87}; static primitive_type _91_primitive = {{0}, primitive_tag, "-", &__91}; @@ -2651,7 +2647,6 @@ const object primitive_Cyc_91cvar_127 = &Cyc_91cvar_127_primitive; const object primitive_Cyc_91has_91cycle_127 = &Cyc_91has_91cycle_127_primitive; const object primitive_Cyc_91spawn_91thread_67 = &Cyc_91spawn_91thread_67_primitive; const object primitive_Cyc_91end_91thread_67 = &Cyc_91end_91thread_67_primitive; -const object primitive_thread_91sleep_67 = &thread_91sleep_67_primitive; const object primitive_Cyc_91minor_91gc = &Cyc_91minor_91gc_primitive; const object primitive__87 = &_87_primitive; const object primitive__91 = &_91_primitive; diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index c880ed31..26ce0363 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -455,7 +455,6 @@ ((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle") ((eq? p 'Cyc-spawn-thread!) "Cyc_spawn_thread") ((eq? p 'Cyc-end-thread!) "Cyc_end_thread") - ((eq? p 'thread-sleep!) "Cyc_thread_sleep") ((eq? p 'Cyc-stdout) "Cyc_stdout") ((eq? p 'Cyc-stdin) "Cyc_stdin") ((eq? p 'Cyc-stderr) "Cyc_stderr") @@ -593,7 +592,6 @@ Cyc-default-exception-handler Cyc-current-exception-handler Cyc-end-thread! - thread-sleep! open-input-file open-output-file close-port diff --git a/scheme/cyclone/transforms.sld b/scheme/cyclone/transforms.sld index 2eea5ea0..39f7da53 100644 --- a/scheme/cyclone/transforms.sld +++ b/scheme/cyclone/transforms.sld @@ -454,7 +454,6 @@ Cyc-has-cycle? Cyc-spawn-thread! Cyc-end-thread! - thread-sleep! Cyc-minor-gc Cyc-stdout Cyc-stdin @@ -565,7 +564,6 @@ Cyc-cvar? Cyc-spawn-thread! Cyc-end-thread! - thread-sleep! Cyc-minor-gc apply %halt diff --git a/scheme/eval.sld b/scheme/eval.sld index 053336e4..e7bec766 100644 --- a/scheme/eval.sld +++ b/scheme/eval.sld @@ -139,7 +139,6 @@ (list 'Cyc-has-cycle? Cyc-has-cycle?) (list 'Cyc-spawn-thread! Cyc-spawn-thread!) (list 'Cyc-end-thread! Cyc-end-thread!) - (list 'thread-sleep! thread-sleep!) (list 'Cyc-default-exception-handler Cyc-default-exception-handler) (list 'Cyc-current-exception-handler Cyc-current-exception-handler) (list '+ +) diff --git a/srfi/18.sld b/srfi/18.sld index 8a5234a5..26a2b93b 100644 --- a/srfi/18.sld +++ b/srfi/18.sld @@ -1,12 +1,14 @@ (define-library (srfi 18) (import (scheme base)) (export + ;; TODO: current-thread thread? make-thread thread-name thread-specific thread-specific-set! thread-start! + thread-sleep! thread-yield! ; thread-terminate! ; For now, these are built-ins. No need for them here: make-mutex mutex-lock! mutex-unlock! @@ -50,6 +52,10 @@ ; (define (thread-terminate!) (Cyc-end-thread!)) ;; TODO: thread-join! + (define-c thread-sleep! + "(void *data, int argc, closure _, object k, object timeout)" + " return_closcall1(data, k, Cyc_thread_sleep(data, timeout)); ") + ;; Take a single object and if it is on the stack, return a copy ;; of it that is allocated on the heap. NOTE the original object ;; will still live on the stack, and will eventually be moved