1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-02 15:40:38 +02:00

Convert mutexes, condition vars to statically-allocated tc16

* libguile/scm.h: Add statically allocated tc16s for condvars and
mutexes.
* libguile/threads.c: Adapt to declare tag inline to struct scm_cond and
struct scm_mutex.
* libguile/threads.h: Expose printing procedures internally.
* module/oop/goops.scm:
* libguile/goops.c: Fix to statically allocate condition variable and
mutex classes.
* libguile/eq.c:
* libguile/print.c: Adapt.
This commit is contained in:
Andy Wingo 2025-06-13 11:45:55 +02:00
parent 7a1406891f
commit f47fe6e752
7 changed files with 114 additions and 67 deletions

View file

@ -52,10 +52,6 @@
/* smob tags for the thread datatypes */
SCM_API scm_t_bits scm_tc16_mutex;
SCM_API scm_t_bits scm_tc16_condvar;
struct scm_thread_wake_data;
struct gc_mutator;
@ -144,10 +140,6 @@ scm_thread_handle (struct scm_thread *thread)
#define SCM_VALIDATE_THREAD(pos, a) \
SCM_ASSERT_TYPE (SCM_I_IS_THREAD (a), (a), (pos), FUNC_NAME, "thread")
#define SCM_VALIDATE_MUTEX(pos, a) \
scm_assert_smob_type (scm_tc16_mutex, (a))
#define SCM_VALIDATE_CONDVAR(pos, a) \
scm_assert_smob_type (scm_tc16_condvar, (a))
SCM_API SCM scm_spawn_thread (scm_t_catch_body body, void *body_data,
scm_t_catch_handler handler, void *handler_data);
@ -161,6 +153,9 @@ SCM_INTERNAL void scm_init_threads_default_dynamic_state (void);
SCM_INTERNAL void scm_i_dynwind_pthread_mutex_lock_block_asyncs (scm_i_pthread_mutex_t *mutex);
SCM_INTERNAL int scm_i_print_thread (SCM t, SCM port, scm_print_state *pstate);
SCM_INTERNAL int scm_i_print_mutex (SCM m, SCM port, scm_print_state *pstate);
SCM_INTERNAL int scm_i_print_condition_variable (SCM cv, SCM port,
scm_print_state *pstate);
SCM_API SCM scm_call_with_new_thread (SCM thunk, SCM handler);
SCM_API SCM scm_yield (void);