예제 #1
0
//
// The implementation of RBMDriver::SetAbsPriority() call.
//
TInt DBMLChannel::SetAbsPriority(TInt aThreadHandle, TInt aNewPrio, TInt* aOldPrio)
	{
	NKern::LockSystem();
	//
	// Under the system lock find the DThread object and increment its ref-count (i.e Open()) 
	//
	DThread* thr = (DThread*) Kern::ObjectFromHandle(&Kern::CurrentThread(), aThreadHandle, EThread);
	TInt r;
	if (!thr)
		{
		r = EBadHandle;
		}
	else
		{
		r = thr->Open();
		}
	//
	// Now it's safe to release the system lock and to work with the object.
	//
	NKern::ThreadEnterCS();
	NKern::UnlockSystem();
	if (r != KErrNone)
		{
		NKern::ThreadLeaveCS();
		return r;
		}
	*aOldPrio = thr->iDefaultPriority;
	Kern::SetThreadPriority(aNewPrio, thr);
	//
	// Work is done - close the object.
	//	
	thr->Close(NULL);
	NKern::ThreadLeaveCS();
	return KErrNone;
	}
예제 #2
0
void DPowerManager::NotifyWakeupEvent(TInt aReason)
	{ // private
	NKern::LockSystem();
	DThread* client = iClient;
	if (!client)
		{
		NKern::UnlockSystem();
		return;
		}
	iClient = NULL;
	Kern::QueueRequestComplete(client, iRequest, aReason);
	NKern::UnlockSystem();
	client->Close(NULL);
	}