mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Issue #279 - Support end-result and return from thread-join
This commit is contained in:
parent
df5438c9f6
commit
2a9d0ea604
2 changed files with 11 additions and 2 deletions
|
@ -5085,6 +5085,10 @@ void _Cyc_91spawn_91thread_67(void *data, object clo, int argc, object *args)
|
|||
|
||||
void _Cyc_91end_91thread_67(void *data, object clo, int argc, object *args)
|
||||
{
|
||||
gc_thread_data *d = data;
|
||||
vector_type *v = d->scm_thread_obj;
|
||||
v->elements[7] = args[0]; // Store thread result
|
||||
|
||||
Cyc_end_thread((gc_thread_data *) data);
|
||||
object cont = args[0];
|
||||
return_closcall1(data, cont, boolean_f);
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
;; - specific
|
||||
;; - internal
|
||||
;; - end of thread cont (or #f for default)
|
||||
;; - end-result - Result of thread that terminates successfully
|
||||
(vector
|
||||
'cyc-thread-obj
|
||||
thunk
|
||||
|
@ -80,6 +81,7 @@
|
|||
name-str
|
||||
#f
|
||||
#f
|
||||
#f
|
||||
#f)))
|
||||
|
||||
(define (thread-name t) (vector-ref t 3))
|
||||
|
@ -151,9 +153,12 @@
|
|||
}
|
||||
return_thread_runnable(data, boolean_t);")
|
||||
(define (thread-join! t)
|
||||
(if (and (thread? t) (Cyc-opaque? (vector-ref t 2)))
|
||||
(cond
|
||||
((and (thread? t) (Cyc-opaque? (vector-ref t 2)))
|
||||
(%thread-join! (vector-ref t 2))
|
||||
#f))
|
||||
(vector-ref t 7))
|
||||
(else
|
||||
#f))) ;; TODO: raise an error instead?
|
||||
|
||||
(define-c thread-sleep!
|
||||
"(void *data, int argc, closure _, object k, object timeout)"
|
||||
|
|
Loading…
Add table
Reference in a new issue