1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

Move to store thread join cond/lock/results directly

* libguile/threads.h: Add join data directly on the thread instead of
using a Scheme-side weak table.  It's less complicated and it will let
the weak table implementation use locks in Scheme; otherwise you would
have threads depending on weak tables and vice versa.
* libguile/threads.c (scm_trace_thread, guilify_self_1): Init and mark
the new members.
(thread_join_cond, thread_join_lock, thread_join_results)
(thread_init_joinable_x, thread_set_join_results_x): New accessors.
* module/ice-9/threads.scm (call-with-new-thread, join-thread): Use the
new accessors.
This commit is contained in:
Andy Wingo 2025-05-07 09:56:10 +02:00
parent 852c0b05c7
commit 1f96d1bf4b
3 changed files with 82 additions and 39 deletions

View file

@ -123,6 +123,12 @@ struct scm_thread {
SCM_STACKITEM *auxiliary_stack_base;
#endif
/* For joinable threads, a cond to wait on joining, and a lock to
protect the results. #f if not joinable. */
SCM join_cond;
SCM join_lock;
SCM join_results;
/* JIT state; NULL until this thread needs to JIT-compile something. */
struct scm_jit_state *jit_state;
};