mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-25 20:50:31 +02:00
Prepare SMOBs for new finalization API
* libguile/atomics-internal.h (scm_atomic_set_bits): New routine. * libguile/smob.c (scm_i_finalize_smob): Use atomics to clear the first word instead of the GC alloc lock. (finalize_smob): Implement as shim.
This commit is contained in:
parent
1a3f427d4e
commit
5e97645b81
3 changed files with 37 additions and 28 deletions
|
@ -1,7 +1,7 @@
|
|||
#ifndef SCM_ATOMICS_INTERNAL_H
|
||||
#define SCM_ATOMICS_INTERNAL_H
|
||||
|
||||
/* Copyright 2016,2018-2019
|
||||
/* Copyright 2016,2018-2019,2025
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -58,6 +58,12 @@ scm_atomic_ref_pointer (void **loc)
|
|||
return (void *) atomic_load (a_loc);
|
||||
}
|
||||
static inline void
|
||||
scm_atomic_set_bits (scm_t_bits *loc, scm_t_bits val)
|
||||
{
|
||||
atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
|
||||
atomic_store (a_loc, val);
|
||||
}
|
||||
static inline void
|
||||
scm_atomic_set_scm (SCM *loc, SCM val)
|
||||
{
|
||||
atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
|
||||
|
@ -136,6 +142,14 @@ scm_atomic_ref_pointer (void **loc)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
scm_atomic_set_bits (scm_t_bits *loc, scm_t_bits val)
|
||||
{
|
||||
scm_i_pthread_mutex_lock (&atomics_lock);
|
||||
*loc = val;
|
||||
scm_i_pthread_mutex_unlock (&atomics_lock);
|
||||
}
|
||||
|
||||
static inline void
|
||||
scm_atomic_set_scm (SCM *loc, SCM val)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue