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

Inline thread wakeup data into "struct scm_thread"

This way we don't allocate an untagged wake data, and we don't need a
type tag.  On the other hand we have to roll a more complicated seqlock,
but that's fine.

Also switch to require C11 atomics.

* libguile/atomics-internal.h: Remove fallback for when we don't have
C11 atomics.
(scm_atomic_ref_uint32, scm_atomic_swap_uint32, scm_atomic_set_uint32):
New helpers.
* libguile/threads-internal.h:
* libguile/async.h:
* libguile/async.c: Inline the thread wake data.  Happily, waking a
remote thread is still wait-free from both sides.
This commit is contained in:
Andy Wingo 2025-06-25 16:00:07 +02:00
parent 7d1eda149e
commit b0ce014801
4 changed files with 170 additions and 179 deletions

View file

@ -1,7 +1,7 @@
#ifndef SCM_ASYNC_H
#define SCM_ASYNC_H
/* Copyright 1995-1998,2000-2002,2004-2006,2008-2009,2011,2014,2018
/* Copyright 1995-1998,2000-2002,2004-2006,2008-2009,2011,2014,2018,2025
Free Software Foundation, Inc.
This file is part of Guile.
@ -48,8 +48,6 @@ SCM_API void *scm_c_call_with_unblocked_asyncs (void *(*p) (void *d), void *d);
SCM_API void scm_dynwind_block_asyncs (void);
SCM_API void scm_dynwind_unblock_asyncs (void);
SCM_INTERNAL int scm_i_prepare_to_wait (scm_thread *,
struct scm_thread_wake_data *);
SCM_INTERNAL void scm_i_wait_finished (scm_thread *);
SCM_INTERNAL int scm_i_prepare_to_wait_on_fd (scm_thread *, int);
SCM_INTERNAL int scm_i_prepare_to_wait_on_cond (scm_thread *,