Changeset 6737 in vbox for trunk/src/VBox
- Timestamp:
- Feb 1, 2008 9:29:47 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 27819
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/linux/sems-linux.cpp
r6731 r6737 868 868 if (RT_UNLIKELY(iOld != 0)) 869 869 { 870 iOld = ASMAtomicXchgS32(&pIntMutexSem->iState, 2); 871 while (iOld != 0) 872 { 870 for (;;) 871 { 872 iOld = ASMAtomicXchgS32(&pIntMutexSem->iState, 2); 873 874 /* 875 * Was the lock released in the meantime? This is unlikely (but possible) 876 */ 877 if (RT_UNLIKELY(iOld == 0)) 878 break; 879 873 880 /* 874 881 * Go to sleep. … … 901 908 return RTErrConvertFromErrno(rc); 902 909 } 903 904 iOld = ASMAtomicXchgS32(&pIntMutexSem->iState, 2); 905 } 910 } 911 912 /* 913 * When leaving this loop, iState is set to 2. This means that we gained the 914 * Lock and there are _possibly_ some waiters. We don't know exactly as another 915 * Thread might entered this loop at nearly the same time. Therefore we will 916 * call futex_wakeup once too often (if _no_ other thread entered this loop). 917 * The key problem is the simple futex_wait test for x != y (iState != 2) in 918 * our case). 919 */ 906 920 } 907 921
Note:
See TracChangeset
for help on using the changeset viewer.