예제 #1
0
int
rw_tryenter(krwlock_t *rw, const krw_t op)
{
	int error;

	error = rumpuser_rw_tryenter(krw2rumprw(op), RUMPRW(rw));
	if (error == 0) {
		WANTLOCK(rw, op == RW_READER);
		LOCKED(rw, op == RW_READER);
	}
	return error == 0;
}
예제 #2
0
void
rumpuser_rw_enter(int enum_rumprwlock, struct rumpuser_rw *rw)
{
	enum rumprwlock lk = enum_rumprwlock;
	struct waithead *w = NULL;
	int nlocks;

	switch (lk) {
	case RUMPUSER_RW_WRITER:
		w = &rw->wwait;
		break;
	case RUMPUSER_RW_READER:
		w = &rw->rwait;
		break;
	}

	if (rumpuser_rw_tryenter(enum_rumprwlock, rw) != 0) {
		rumpkern_unsched(&nlocks, NULL);
		while (rumpuser_rw_tryenter(enum_rumprwlock, rw) != 0)
			wait(w, BMK_SCHED_BLOCK_INFTIME);
		rumpkern_sched(nlocks, NULL);
	}
}
예제 #3
0
int
rw_tryenter(krwlock_t *rw, const krw_t op)
{

	return rumpuser_rw_tryenter(rw->krw_pthlock, op == RW_WRITER);
}