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

* guardians.c (guardian_print): for sharing guardians, print that

they are sharing.
(scm_guard, scm_get_one_zombie): place the critical section
barriers more correctly.
This commit is contained in:
Michael Livshin 2000-12-30 19:26:37 +00:00
parent d9dcd93362
commit 75bc0690c8
2 changed files with 22 additions and 7 deletions

View file

@ -1,5 +1,10 @@
2000-12-30 Michael Livshin <mlivshin@bigfoot.com> 2000-12-30 Michael Livshin <mlivshin@bigfoot.com>
* guardians.c (guardian_print): for sharing guardians, print that
they are sharing.
(scm_guard, scm_get_one_zombie): place the critical section
barriers more correctly.
* weaks.c (scm_scan_weak_vectors): move the calculation of the * weaks.c (scm_scan_weak_vectors): move the calculation of the
`weak_keys' and `weak_values' flags out of the inner loop. `weak_keys' and `weak_values' flags out of the inner loop.

View file

@ -182,6 +182,8 @@ guardian_print (SCM g, SCM port, scm_print_state *pstate)
scm_puts ("#<", port); scm_puts ("#<", port);
if (GUARDIAN_GREEDY_P (g)) if (GUARDIAN_GREEDY_P (g))
scm_puts ("greedy ", port); scm_puts ("greedy ", port);
else
scm_puts ("sharing ", port);
scm_puts ("guardian (reachable: ", port); scm_puts ("guardian (reachable: ", port);
scm_display (scm_length (SCM_CDR (GUARDIAN_LIVE (g).head)), port); scm_display (scm_length (SCM_CDR (GUARDIAN_LIVE (g).head)), port);
scm_puts (" unreachable: ", port); scm_puts (" unreachable: ", port);
@ -216,24 +218,30 @@ scm_guard (SCM guardian, SCM obj)
{ {
SCM z; SCM z;
SCM_NEWCELL (z);
/* This critical section barrier will be replaced by a mutex. */
SCM_DEFER_INTS;
if (GUARDIAN_GREEDY_P (guardian)) if (GUARDIAN_GREEDY_P (guardian))
{ {
if (SCM_NFALSEP (scm_hashq_get_handle if (SCM_NFALSEP (scm_hashq_get_handle
(greedily_guarded_whash, obj))) (greedily_guarded_whash, obj)))
{
SCM_ALLOW_INTS;
scm_misc_error ("guard", scm_misc_error ("guard",
"object is already greedily guarded", obj); "object is already greedily guarded", obj);
}
else else
scm_hashq_create_handle_x (greedily_guarded_whash, scm_hashq_create_handle_x (greedily_guarded_whash,
obj, guardian); obj, guardian);
} }
SCM_NEWCELL (z);
/* This critical section barrier will be replaced by a mutex. */
SCM_DEFER_INTS;
TCONC_IN (GUARDIAN_LIVE (guardian), obj, z); TCONC_IN (GUARDIAN_LIVE (guardian), obj, z);
SCM_ALLOW_INTS; SCM_ALLOW_INTS;
} }
} }
@ -244,9 +252,9 @@ scm_get_one_zombie (SCM guardian)
/* This critical section barrier will be replaced by a mutex. */ /* This critical section barrier will be replaced by a mutex. */
SCM_DEFER_INTS; SCM_DEFER_INTS;
if (!TCONC_EMPTYP (GUARDIAN_ZOMBIES (guardian))) if (!TCONC_EMPTYP (GUARDIAN_ZOMBIES (guardian)))
TCONC_OUT (GUARDIAN_ZOMBIES (guardian), res); TCONC_OUT (GUARDIAN_ZOMBIES (guardian), res);
SCM_ALLOW_INTS;
if (SCM_NFALSEP (res) if (SCM_NFALSEP (res)
&& GUARDIAN_GREEDY_P (guardian) && GUARDIAN_GREEDY_P (guardian)
@ -254,6 +262,8 @@ scm_get_one_zombie (SCM guardian)
(greedily_guarded_whash, res))) (greedily_guarded_whash, res)))
scm_hashq_remove_x (greedily_guarded_whash, res); scm_hashq_remove_x (greedily_guarded_whash, res);
SCM_ALLOW_INTS;
return res; return res;
} }