コード例 #1
0
ファイル: thread.c プロジェクト: lougxing/golang-china
void
usemrelease(Usema *s)
{
	if((int32)xadd(&s->u, 1) <= 0) {
		if(s->k == 0)
			initsema(&s->k);
		mach_semrelease(s->k);
	}
}
コード例 #2
0
ファイル: thread.c プロジェクト: lougxing/golang-china
void
unlock(Lock *l)
{
	m->locks--;
	if(m->locks < 0)
		throw("lock count");

	if(xadd(&l->key, -1) > 0) {	// someone else is waiting
		// Allocate semaphore if needed.
		if(l->sema == 0)
			initsema(&l->sema);
		mach_semrelease(l->sema);
	}
}
コード例 #3
0
ファイル: thread_darwin.c プロジェクト: icattlecoder/go
void
runtime·semawakeup(M *mp)
{
	runtime·mach_semrelease(mp->waitsema);
}