Beispiel #1
0
void
_thr_wake_all(unsigned int *waddrs[], int count)
{
	int i;

	for (i = 0; i < count; ++i)
		*waddrs[i] = 1;
	_umtx_op(waddrs, UMTX_OP_NWAKE_PRIVATE, count, NULL, NULL);
}
Beispiel #2
0
/*
 * Among all processes sharing a lock only one executes
 * pthread_lock_destroy().  Other processes still have the hash and
 * mapped off-page.
 *
 * Mitigate the problem by checking the liveness of all hashed keys
 * periodically.  Right now this is executed on each
 * pthread_lock_destroy(), but may be done less often if found to be
 * too time-consuming.
 */
static void
pshared_gc(struct pthread *curthread)
{
    struct pshared_hash_head *hd;
    struct psh *h, *h1;
    int error, i;

    pshared_wlock(curthread);
    for (i = 0; i < HASH_SIZE; i++) {
        hd = &pshared_hash[i];
        LIST_FOREACH_SAFE(h, hd, link, h1) {
            error = _umtx_op(NULL, UMTX_OP_SHM, UMTX_SHM_ALIVE,
                             h->val, NULL);
            if (error == 0)
                continue;
            LIST_REMOVE(h, link);
            munmap(h->val, PAGE_SIZE);
            free(h);
        }
    }
Beispiel #3
0
int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2)
{
	if (_umtx_op(obj, op, val, uaddr, uaddr2) == -1)
		return (errno);
	return (0);
}