mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-08 21:20:19 +02:00
Add ephemeron-table-clear!; ephemeron key can be immediate
* libguile/ephemerons.c (scm_make_ephemeron): Relax restriction that key be a heap object. It's too annoying otherwise. (scm_c_ephemeron_table_clear_x): (scm_ephemeron_table_clear_x): New interface. * module/ice-9/ephemerons.scm: Expose ephemeron-table-clear!. * test-suite/tests/ephemerons.test ("ephemerons"): Update tests.
This commit is contained in:
parent
c35cbd65f1
commit
d457aaa57d
4 changed files with 49 additions and 10 deletions
|
@ -57,6 +57,12 @@ scm_atomic_ref_pointer (void **loc)
|
|||
atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
|
||||
return (void *) atomic_load (a_loc);
|
||||
}
|
||||
static inline void *
|
||||
scm_atomic_swap_pointer (void **loc, void *new_val)
|
||||
{
|
||||
atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
|
||||
return (void *) atomic_exchange (a_loc, (uintptr_t) new_val);
|
||||
}
|
||||
static inline void
|
||||
scm_atomic_set_bits (scm_t_bits *loc, scm_t_bits val)
|
||||
{
|
||||
|
@ -141,6 +147,16 @@ scm_atomic_ref_pointer (void **loc)
|
|||
scm_i_pthread_mutex_unlock (&atomics_lock);
|
||||
return ret;
|
||||
}
|
||||
static inline void *
|
||||
scm_atomic_swap_pointer (void **loc, void *new_val)
|
||||
{
|
||||
void *ret;
|
||||
scm_i_pthread_mutex_lock (&atomics_lock);
|
||||
ret = *loc;
|
||||
*loc = new_val;
|
||||
scm_i_pthread_mutex_unlock (&atomics_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
scm_atomic_set_bits (scm_t_bits *loc, scm_t_bits val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue