Exemple #1
0
EXPORT void
hal_destroylock(struct THALBase *hal, struct THALObject *lock)
{
	CRITICAL_SECTION *cs = THALGetObject(lock, CRITICAL_SECTION);
	DeleteCriticalSection(cs);
	THALDestroyObject(hal, cs, CRITICAL_SECTION);
}
Exemple #2
0
EXPORT void
hal_lock(struct THALBase *hal, struct THALObject *lock)
{
	CRITICAL_SECTION *cs;
	cs = THALGetObject(lock, CRITICAL_SECTION);
	EnterCriticalSection(cs);
}
Exemple #3
0
static TBOOL hal_replytimereq(struct TTimeRequest *tr)
{
	TBOOL success = TFALSE;
	struct TMessage *msg = TGETMSGPTR(tr);
	struct TMsgPort *mp = msg->tmsg_RPort;
	CRITICAL_SECTION *mplock = THALGetObject((TAPTR) &mp->tmp_Lock,
		CRITICAL_SECTION);
	if (TryEnterCriticalSection(mplock))
	{
		struct TTask *sigtask = mp->tmp_SigTask;
		struct HALThread *t =
			THALGetObject((TAPTR) &sigtask->tsk_Thread, struct HALThread);
		if (TryEnterCriticalSection(&t->hth_SigLock))
		{
			tr->ttr_Req.io_Error = 0;
			msg->tmsg_Flags = TMSG_STATUS_REPLIED | TMSGF_QUEUED;
			TAddTail(&mp->tmp_MsgList, &msg->tmsg_Node);
			if (mp->tmp_Signal & ~t->hth_SigState)
			{
				t->hth_SigState |= mp->tmp_Signal;
				SetEvent(t->hth_SigEvent);
			}
			LeaveCriticalSection(&t->hth_SigLock);
			success = TTRUE;
		}
		LeaveCriticalSection(mplock);
	}
	return success;
}