kernel/eka/euser/epoc/win32/uc_utl.cpp
changeset 201 43365a9b78a3
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
200:73ea206103e6 201:43365a9b78a3
   110 
   110 
   111 EXPORT_C void RFastLock::Wait()
   111 EXPORT_C void RFastLock::Wait()
   112 	{
   112 	{
   113 	if (InterlockedDecrement((LPLONG)&iCount) < -1)
   113 	if (InterlockedDecrement((LPLONG)&iCount) < -1)
   114 		RSemaphore::Wait();
   114 		RSemaphore::Wait();
       
   115 	}
       
   116 
       
   117 EXPORT_C __NAKED__ TInt RFastLock::Poll()
       
   118 	{
       
   119 	_asm xor eax, eax
       
   120 	_asm xor edx, edx
       
   121 	_asm dec edx
       
   122 
       
   123 	/* if ([ecx+4]==0) { [ecx+4]=-1; ZF=1;} else {eax=[ecx+4]; ZF=0;} */
       
   124 	_asm lock cmpxchg [ecx+4], edx
       
   125 	_asm jz short fastlock_poll_done
       
   126 	_asm mov eax, -33
       
   127 
       
   128 	fastlock_poll_done:
       
   129 	_asm ret
   115 	}
   130 	}
   116 
   131 
   117 EXPORT_C void RFastLock::Signal()
   132 EXPORT_C void RFastLock::Signal()
   118 	{
   133 	{
   119 	if (InterlockedIncrement((LPLONG)&iCount) < 0)
   134 	if (InterlockedIncrement((LPLONG)&iCount) < 0)