Let collector know mutator is blocking

This commit is contained in:
Justin Ethier 2016-02-23 20:09:51 -05:00
parent 67e588a242
commit 51748fb957

View file

@ -91,8 +91,9 @@
(define-c thread-sleep! (define-c thread-sleep!
"(void *data, int argc, closure _, object k, object timeout)" "(void *data, int argc, closure _, object k, object timeout)"
" Cyc_thread_sleep(data, timeout); " set_thread_blocked(data, k);
return_closcall1(data, k, boolean_t); ") Cyc_thread_sleep(data, timeout);
return_thread_runnable(data, boolean_t); ")
;; Take a single object and if it is on the stack, return a copy ;; 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 ;; of it that is allocated on the heap. NOTE the original object
@ -191,13 +192,14 @@
"(void *data, int argc, closure _, object k, object cond, object lock)" "(void *data, int argc, closure _, object k, object cond, object lock)"
" Cyc_check_cond_var(data, cond); " Cyc_check_cond_var(data, cond);
Cyc_check_mutex(data, lock); Cyc_check_mutex(data, lock);
set_thread_blocked(data, k);
if (pthread_cond_wait( if (pthread_cond_wait(
&(((cond_var)cond)->cond), &(((cond_var)cond)->cond),
&(((mutex)lock)->lock)) != 0) { &(((mutex)lock)->lock)) != 0) {
fprintf(stderr, \"Unable to wait for condition variable\\n\"); fprintf(stderr, \"Unable to wait for condition variable\\n\");
exit(1); exit(1);
} }
return_closcall1(data, k, boolean_t); ") return_thread_runnable(data, boolean_t); ")
(define-c condition-variable-signal! (define-c condition-variable-signal!
"(void *data, int argc, closure _, object k, object cond)" "(void *data, int argc, closure _, object k, object cond)"
" Cyc_check_cond_var(data, cond); " Cyc_check_cond_var(data, cond);