Changeset 6731 in vbox
- Timestamp:
- Feb 1, 2008 7:34:27 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/linux/sems-linux.cpp
r6727 r6731 866 866 int32_t iOld; 867 867 ASMAtomicCmpXchgExS32(&pIntMutexSem->iState, 1, 0, &iOld); 868 if ( iOld != 0)869 { 870 871 872 868 if (RT_UNLIKELY(iOld != 0)) 869 { 870 iOld = ASMAtomicXchgS32(&pIntMutexSem->iState, 2); 871 while (iOld != 0) 872 { 873 873 /* 874 874 * Go to sleep. … … 884 884 { 885 885 Assert(pTimeout); 886 iOld = ASMAtomicXchgS32(&pIntMutexSem->iState, 2);887 886 return VERR_TIMEOUT; 888 887 } 889 890 888 if (rc == 0) 889 /* we'll leave the loop now unless another thread is faster */; 891 890 else if (rc == -EWOULDBLOCK) 892 891 /* retry with new value. */; … … 903 902 } 904 903 905 906 904 iOld = ASMAtomicXchgS32(&pIntMutexSem->iState, 2); 905 } 907 906 } 908 907 … … 976 975 { 977 976 /* somebody is waiting, try wake up one of them. */ 978 pIntMutexSem->iState = 0;977 ASMAtomicXchgS32(&pIntMutexSem->iState, 0); 979 978 (void)sys_futex(&pIntMutexSem->iState, FUTEX_WAKE, 1, NULL, NULL, 0); 980 979 }
Note:
See TracChangeset
for help on using the changeset viewer.