vbox的更動 43560 路徑 trunk/src/VBox/Runtime/r3/posix
- 時間撮記:
- 2012-10-8 上午08:12:25 (12 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
r43559 r43560 70 70 * This function emulate pthread_mutex_timedlock on Mac OS X 71 71 */ 72 static int DarwinPthreadMutexTimedlock(pthread_mutex_t * mutex, const struct timespec * abs_timeout)72 static int DarwinPthreadMutexTimedlock(pthread_mutex_t * mutex, const struct timespec * pTsAbsTimeout) 73 73 { 74 74 int rc = 0; 75 75 struct timeval tv; 76 struct timespec rt;76 timespec ts = {0, 0}; 77 77 do 78 78 { … … 80 80 if (rc == EBUSY) 81 81 { 82 timespec ts; 83 ts.tv_sec = 0; 84 ts.tv_sec = 10000000; 85 86 int rcSleep = -1; 87 while (rcSleep == -1) 88 rcSleep = nanosleep(&ts, &ts); 82 gettimeofday(&tv, NULL); 83 84 ts.tv_sec = pTsAbsTimeout->tv_sec - tv.tv_sec; 85 ts.tv_nsec = pTsAbsTimeout->tv_nsec - tv.tv_sec; 86 87 if (ts.tv_nsec < 0) 88 { 89 ts.tv_sec--; 90 ts.tv_nsec += 1000000000; 91 } 92 93 if ( ts.tv_sec > 0 94 && ts.tv_nsec > 0) 95 nanosleep(&ts, &ts); 89 96 } 90 97 else 91 98 break; 92 gettimeofday(&tv, NULL);93 rt.tv_sec = abs_timeout->tv_sec - tv.tv_sec;94 rt.tv_nsec = abs_timeout->tv_nsec - tv.tv_usec * 1000;95 99 } while ( rc != 0 96 || rt.tv_sec <0);100 || ts.tv_sec > 0); 97 101 return rc; 98 102 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器