kernel/eka/kernel/sutils.cpp
changeset 243 c7a0ce20c48c
parent 134 95847726fe57
child 254 1560c419b176
equal deleted inserted replaced
231:75252ea6123b 243:c7a0ce20c48c
  3546 	return ETrue;
  3546 	return ETrue;
  3547 	}
  3547 	}
  3548 
  3548 
  3549 void TClientRequest::EndComplete(DThread* aThread)
  3549 void TClientRequest::EndComplete(DThread* aThread)
  3550 	{
  3550 	{
       
  3551 	// NB: if the callback is successfully queued, the target thread may run and
       
  3552 	// process it before we get back from the call to QueueUserModeCallback().
       
  3553 	// In that case, 'iStatus' will be changed; and in general it is not safe to
       
  3554 	// look at any element of 'this' once the callback is queued, as it may change
       
  3555 	// asynchronously.  Therefore, we must cache the value of 'iStatus' beforehand
       
  3556 	// and later use this saved copy to decide whether to signal the target thread.
       
  3557 	T_UintPtr status = iStatus;
  3551 	TInt r = NKern::QueueUserModeCallback(&aThread->iNThread, this);
  3558 	TInt r = NKern::QueueUserModeCallback(&aThread->iNThread, this);
       
  3559 
  3552 	if (r == KErrNone)
  3560 	if (r == KErrNone)
  3553 		{
  3561 		{
  3554 		if (iStatus != (KClientRequestNullStatus | KClientRequestFlagInUse))
  3562 		__NK_ASSERT_DEBUG(status & KClientRequestFlagInUse);
       
  3563 		if ((status & ~KClientRequestFlagInUse) != KClientRequestNullStatus)
  3555 			NKern::ThreadRequestSignal(&aThread->iNThread);
  3564 			NKern::ThreadRequestSignal(&aThread->iNThread);
  3556 		}
  3565 		}
  3557 	else
  3566 	else
  3558 		{
  3567 		{
  3559 		__NK_ASSERT_DEBUG(r == KErrDied);
  3568 		__NK_ASSERT_DEBUG(r == KErrDied);