genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp
changeset 71 28ccaba883f4
parent 67 a1e347446159
equal deleted inserted replaced
67:a1e347446159 71:28ccaba883f4
   187 		if(err == KErrNone)
   187 		if(err == KErrNone)
   188 			{	
   188 			{	
   189 			//Create Server Locks
   189 			//Create Server Locks
   190 			err |= iSSLock.CreateLocal();
   190 			err |= iSSLock.CreateLocal();
   191 			err |= iCSLock.CreateLocal();
   191 			err |= iCSLock.CreateLocal();
   192 			err |= iIpcS.iLock.CreateLocal();
       
   193 			//Create TLDList Lock
   192 			//Create TLDList Lock
   194 			err |= iTLDListLock.CreateLocal();
   193 			err |= iTLDListLock.CreateLocal();
   195 			//Create the lock for Session Path
   194 			//Create the lock for Session Path
   196 			err |= iSessionPathLock.CreateLocal();
   195 			err |= iSessionPathLock.CreateLocal();
   197 			//Lock for protecting iASelectRequest across threads
   196 			//Lock for protecting iASelectRequest across threads
  2189 
  2188 
  2190     if (timeout) 
  2189     if (timeout) 
  2191         { 
  2190         { 
  2192         timer.After(*reqarray[numReqs+arraycount], timeout); 
  2191         timer.After(*reqarray[numReqs+arraycount], timeout); 
  2193         // Wait for any request to complete 
  2192         // Wait for any request to complete 
  2194         CLocalSystemInterface::WaitForNRequest(*reqarray, numReqs+arraycount+1);     
  2193         CLocalSystemInterface::WaitForNRequest(reqarray, numReqs+arraycount+1);     
  2195         if( (*reqarray[numReqs+arraycount]).Int() == KRequestPending) 
  2194         if( (*reqarray[numReqs+arraycount]).Int() == KRequestPending) 
  2196             {
  2195             {
  2197             // The timer hasn't fired yet.
  2196             // The timer hasn't fired yet.
  2198             timer.Cancel(); 
  2197             timer.Cancel(); 
  2199             }
  2198             }
  2204         timer.Close();
  2203         timer.Close();
  2205         // No need to set onedown to True as numReqs does not include the Timer request
  2204         // No need to set onedown to True as numReqs does not include the Timer request
  2206         } 
  2205         } 
  2207     else 
  2206     else 
  2208         { 
  2207         { 
  2209         CLocalSystemInterface::WaitForNRequest(*reqarray, numReqs+arraycount);
  2208         CLocalSystemInterface::WaitForNRequest(reqarray, numReqs+arraycount);
  2210         // Completion Status of one request has been gathered
  2209         // Completion Status of one request has been gathered
  2211         onedown = ETrue;
  2210         onedown = ETrue;
  2212         }
  2211         }
  2213 
  2212 
  2214     for (int i = 0; i < numReqs; ++i) 
  2213     for (int i = 0; i < numReqs; ++i) 
  3643 //
  3642 //
  3644 const CFileTable& CLocalSystemInterface::FileTable() const
  3643 const CFileTable& CLocalSystemInterface::FileTable() const
  3645 {
  3644 {
  3646 return iFids;
  3645 return iFids;
  3647 }
  3646 }
       
  3647 
       
  3648 // ---------------------------------------------------------------------------------
       
  3649 // CLocalSystemInterface::WaitForNRequest
       
  3650 // Wait for any one of the input asynchronous requests to complete
       
  3651 // Used in lieu of User::WaitForNRequest because of need to support pre-Argus builds
       
  3652 // ---------------------------------------------------------------------------------
       
  3653 //
       
  3654 void CLocalSystemInterface::WaitForNRequest(TRequestStatus **aStatusArray, TInt aNum)
       
  3655 	{
       
  3656 	if (aNum)
       
  3657 		{
       
  3658 		// used to keep count of requests we have not been asked to wait for
       
  3659 		TInt nOther = -1;
       
  3660 		TBool done = EFalse;
       
  3661 
       
  3662 		do
       
  3663 			{
       
  3664 			++nOther;
       
  3665 			User::WaitForAnyRequest();
       
  3666 			for (TInt i = 0; i < aNum; ++i)
       
  3667 				{
       
  3668 				if ((*aStatusArray[i]).Int() != KRequestPending)
       
  3669 					{
       
  3670 					done = ETrue;
       
  3671 					break;
       
  3672 					}
       
  3673 				}
       
  3674 			} while (!done);
       
  3675 
       
  3676 		if (nOther)
       
  3677 			{
       
  3678 			// Adjust the thread's signal semaphore to account for the requests
       
  3679 			// we were not asked to wait for.
       
  3680 			RThread thrd;
       
  3681 			for (TInt i = 0; i < nOther; ++i)
       
  3682 				{
       
  3683 				thrd.RequestSignal();
       
  3684 				}
       
  3685 			}
       
  3686 		}
       
  3687 	}
  3648 
  3688 
  3649 // ---------------------------------------------------------------------------------
  3689 // ---------------------------------------------------------------------------------
  3650 // CLocalSystemInterface::WaitForNRequest
  3690 // CLocalSystemInterface::WaitForNRequest
  3651 // Wait for any one of the input asynchronous requests to complete
  3691 // Wait for any one of the input asynchronous requests to complete
  3652 // Used in lieu of User::WaitForNRequest because of need to support pre-Argus builds
  3692 // Used in lieu of User::WaitForNRequest because of need to support pre-Argus builds