mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
srfi-18: revert thread-terminate! changes
These changes need to be revisited, and are not suitable for the threads garbage collection pull request.
This commit is contained in:
parent
b13c277677
commit
ee4858087b
1 changed files with 3 additions and 15 deletions
18
srfi/18.sld
18
srfi/18.sld
|
@ -142,21 +142,9 @@
|
||||||
t))
|
t))
|
||||||
|
|
||||||
(define (thread-yield!) (thread-sleep! 1))
|
(define (thread-yield!) (thread-sleep! 1))
|
||||||
|
(define-c thread-terminate!
|
||||||
(define-c %thread-terminate!
|
"(void *data, object _, int argc, object *args)"
|
||||||
"(void *data, int argc, closure _, object k, object thread_data_opaque)"
|
" Cyc_end_thread(data); ")
|
||||||
" gc_thread_data *td = (gc_thread_data *)(opaque_ptr(thread_data_opaque));
|
|
||||||
Cyc_end_thread(td);
|
|
||||||
/* TODO: if terminating the current thread, don't return */
|
|
||||||
return_closcall1(data, k, boolean_t);")
|
|
||||||
(define (thread-terminate! t)
|
|
||||||
(cond
|
|
||||||
((and (thread? t) (Cyc-opaque? (vector-ref t 2)))
|
|
||||||
(begin
|
|
||||||
(Cyc-minor-gc)
|
|
||||||
(%thread-terminate! (vector-ref t 2))))
|
|
||||||
(else
|
|
||||||
#f))) ;; TODO: raise an error instead?
|
|
||||||
|
|
||||||
;; TODO: not good enough, need to return value from thread
|
;; TODO: not good enough, need to return value from thread
|
||||||
;; TODO: perhaps not an ideal solution using a loop/polling below, but good
|
;; TODO: perhaps not an ideal solution using a loop/polling below, but good
|
||||||
|
|
Loading…
Add table
Reference in a new issue