size_t obj_size;
size_t capacity;
unsigned weakobj_kind;
- struct weakmap_link **links;
+ struct weakmap_link **links; /* NULL means weakmap is destroyed */
};
void weakmap_lock(struct weakmap *wm, unsigned h)
my_assert((hdr & INVALIDATE_FLAG) == 0);
wm = (struct weakmap *)(hdr & ~(GC_word)FINALIZER_CLOSURE_FLAG);
+ if (NULL == wm->links)
+ return 0; /* weakmap has been already destroyed */
obj = (GC_word *)obj_base + 1;
/* Lock and check for mark. */
for (i = 0; i < WEAKMAP_MUTEX_COUNT; ++i) {
(void)pthread_mutex_destroy(&wm->mutex[i]);
}
-# else
- (void)wm;
# endif
+ wm->links = NULL; /* weakmap is destroyed */
}
struct weakmap *pair_hcset;