Changeset 25638 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Jan 4, 2010 4:08:04 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56338
- Location:
- trunk/src/VBox/Runtime/r3/posix
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semevent-posix.cpp
r14318 r25638 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 33 33 *******************************************************************************/ 34 34 #include <iprt/semaphore.h> 35 #include "internal/iprt.h" 36 37 #include <iprt/asm.h> 35 38 #include <iprt/assert.h> 36 #include <iprt/alloc.h>37 #include <iprt/asm.h>38 39 #include <iprt/err.h> 40 #include <iprt/mem.h> 41 #include <iprt/lockvalidator.h> 42 43 #include "internal/strict.h" 39 44 40 45 #include <errno.h> … … 72 77 /** Number of waiters. */ 73 78 volatile uint32_t cWaiters; 79 #ifdef RTSEMEVENT_STRICT 80 /** Signallers. */ 81 RTLOCKVALRECSHRD Signallers; 82 /** Indicates that lock validation should be performed. */ 83 bool volatile fEverHadSignallers; 84 #endif 74 85 }; 75 86 … … 85 96 86 97 87 /**88 * Validate an Event semaphore handle passed to one of the interface.89 *90 * @returns true if valid.91 * @returns false if invalid.92 * @param pIntEventSem Pointer to the event semaphore to validate.93 */94 inline bool rtsemEventValid(struct RTSEMEVENTINTERNAL *pIntEventSem)95 {96 if ((uintptr_t)pIntEventSem < 0x10000)97 return false;98 99 uint32_t u32 = pIntEventSem->u32State; /* this is volatile, so a explicit read like this is needed. */100 if ( u32 != EVENT_STATE_NOT_SIGNALED101 && u32 != EVENT_STATE_SIGNALED)102 return false;103 104 return true;105 }106 107 108 98 RTDECL(int) RTSemEventCreate(PRTSEMEVENT pEventSem) 109 99 { … … 113 103 * Allocate semaphore handle. 114 104 */ 115 struct RTSEMEVENTINTERNAL *p IntEventSem= (struct RTSEMEVENTINTERNAL *)RTMemAlloc(sizeof(struct RTSEMEVENTINTERNAL));116 if (p IntEventSem)105 struct RTSEMEVENTINTERNAL *pThis = (struct RTSEMEVENTINTERNAL *)RTMemAlloc(sizeof(struct RTSEMEVENTINTERNAL)); 106 if (pThis) 117 107 { 118 108 /* … … 123 113 if (!rc) 124 114 { 125 rc = pthread_cond_init(&p IntEventSem->Cond, &CondAttr);115 rc = pthread_cond_init(&pThis->Cond, &CondAttr); 126 116 if (!rc) 127 117 { … … 133 123 if (!rc) 134 124 { 135 rc = pthread_mutex_init(&p IntEventSem->Mutex, &MutexAttr);125 rc = pthread_mutex_init(&pThis->Mutex, &MutexAttr); 136 126 if (!rc) 137 127 { … … 139 129 pthread_condattr_destroy(&CondAttr); 140 130 141 ASMAtomicXchgU32(&pIntEventSem->u32State, EVENT_STATE_NOT_SIGNALED); 142 ASMAtomicXchgU32(&pIntEventSem->cWaiters, 0); 143 144 *pEventSem = pIntEventSem; 131 ASMAtomicXchgU32(&pThis->u32State, EVENT_STATE_NOT_SIGNALED); 132 ASMAtomicXchgU32(&pThis->cWaiters, 0); 133 #ifdef RTSEMEVENT_STRICT 134 RTLockValidatorRecSharedInit(&pThis->Signallers, 135 NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_ANY, 136 "RTSemEvent", pThis, true /*fSignaller*/); 137 pThis->fEverHadSignallers = false; 138 #endif 139 140 *pEventSem = pThis; 145 141 return VINF_SUCCESS; 146 142 } 147 143 pthread_mutexattr_destroy(&MutexAttr); 148 144 } 149 pthread_cond_destroy(&p IntEventSem->Cond);145 pthread_cond_destroy(&pThis->Cond); 150 146 } 151 147 pthread_condattr_destroy(&CondAttr); … … 153 149 154 150 rc = RTErrConvertFromErrno(rc); 155 RTMemFree(p IntEventSem);151 RTMemFree(pThis); 156 152 } 157 153 else … … 167 163 * Validate handle. 168 164 */ 169 if (EventSem == NIL_RTSEMEVENT) /* don't bitch */ 165 struct RTSEMEVENTINTERNAL *pThis = EventSem; 166 if (pThis == NIL_RTSEMEVENT) /* don't bitch */ 170 167 return VERR_INVALID_HANDLE; 171 if (!rtsemEventValid(EventSem)) 172 { 173 AssertMsgFailed(("Invalid handle %p!\n", EventSem)); 174 return VERR_INVALID_HANDLE; 175 } 168 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 169 uint32_t u32 = pThis->u32State; 170 AssertReturn(u32 == EVENT_STATE_NOT_SIGNALED || u32 == EVENT_STATE_SIGNALED, VERR_INVALID_HANDLE); 176 171 177 172 /* 178 173 * Abort all waiters forcing them to return failure. 179 * 180 */ 181 struct RTSEMEVENTINTERNAL *pIntEventSem = EventSem; 174 */ 182 175 int rc; 183 176 for (int i = 30; i > 0; i--) 184 177 { 185 ASMAtomicXchgU32(&p IntEventSem->u32State, EVENT_STATE_UNINITIALIZED);186 rc = pthread_cond_destroy(&p IntEventSem->Cond);178 ASMAtomicXchgU32(&pThis->u32State, EVENT_STATE_UNINITIALIZED); 179 rc = pthread_cond_destroy(&pThis->Cond); 187 180 if (rc != EBUSY) 188 181 break; 189 pthread_cond_broadcast(&p IntEventSem->Cond);182 pthread_cond_broadcast(&pThis->Cond); 190 183 usleep(1000); 191 184 } … … 202 195 for (int i = 30; i > 0; i--) 203 196 { 204 rc = pthread_mutex_destroy(&p IntEventSem->Mutex);197 rc = pthread_mutex_destroy(&pThis->Mutex); 205 198 if (rc != EBUSY) 206 199 break; … … 216 209 * Free the semaphore memory and be gone. 217 210 */ 218 RTMemFree(pIntEventSem); 211 #ifdef RTSEMEVENT_STRICT 212 RTLockValidatorRecSharedDelete(&pThis->Signallers); 213 #endif 214 RTMemFree(pThis); 219 215 return VINF_SUCCESS; 220 216 } … … 226 222 * Validate input. 227 223 */ 228 if (!rtsemEventValid(EventSem)) 229 { 230 AssertMsgFailed(("Invalid handle %p!\n", EventSem)); 231 return VERR_INVALID_HANDLE; 232 } 224 struct RTSEMEVENTINTERNAL *pThis = EventSem; 225 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 226 uint32_t u32 = pThis->u32State; 227 AssertReturn(u32 == EVENT_STATE_NOT_SIGNALED || u32 == EVENT_STATE_SIGNALED, VERR_INVALID_HANDLE); 228 229 #ifdef RTSEMEVENT_STRICT 230 if (pThis->fEverHadSignallers) 231 { 232 int rc9 = RTLockValidatorRecSharedCheckSignaller(&pThis->Signallers, NIL_RTTHREAD); 233 if (RT_FAILURE(rc9)) 234 return rc9; 235 } 236 #endif 233 237 234 238 /* 235 239 * Lock the mutex semaphore. 236 240 */ 237 struct RTSEMEVENTINTERNAL *pIntEventSem = EventSem; 238 int rc = pthread_mutex_lock(&pIntEventSem->Mutex); 241 int rc = pthread_mutex_lock(&pThis->Mutex); 239 242 if (rc) 240 243 { … … 246 249 * Check the state. 247 250 */ 248 if (p IntEventSem->u32State == EVENT_STATE_NOT_SIGNALED)249 { 250 ASMAtomicXchgU32(&p IntEventSem->u32State, EVENT_STATE_SIGNALED);251 rc = pthread_cond_signal(&p IntEventSem->Cond);251 if (pThis->u32State == EVENT_STATE_NOT_SIGNALED) 252 { 253 ASMAtomicXchgU32(&pThis->u32State, EVENT_STATE_SIGNALED); 254 rc = pthread_cond_signal(&pThis->Cond); 252 255 AssertMsg(!rc, ("Failed to signal event sem %p, rc=%d.\n", EventSem, rc)); 253 256 } 254 else if (p IntEventSem->u32State == EVENT_STATE_SIGNALED)255 { 256 rc = pthread_cond_signal(&p IntEventSem->Cond); /* give'm another kick... */257 else if (pThis->u32State == EVENT_STATE_SIGNALED) 258 { 259 rc = pthread_cond_signal(&pThis->Cond); /* give'm another kick... */ 257 260 AssertMsg(!rc, ("Failed to signal event sem %p, rc=%d. (2)\n", EventSem, rc)); 258 261 } … … 263 266 * Release the mutex and return. 264 267 */ 265 int rc2 = pthread_mutex_unlock(&p IntEventSem->Mutex);268 int rc2 = pthread_mutex_unlock(&pThis->Mutex); 266 269 AssertMsg(!rc2, ("Failed to unlock event sem %p, rc=%d.\n", EventSem, rc)); 267 270 if (rc) … … 274 277 275 278 276 static int rtSemEventWait(RTSEMEVENT EventSem, unsigned cMillies, bool fAutoResume) 277 { 279 DECL_FORCE_INLINE(int) rtSemEventWait(RTSEMEVENT EventSem, unsigned cMillies, bool fAutoResume) 280 { 281 PCRTLOCKVALSRCPOS pSrcPos = NULL; 282 278 283 /* 279 284 * Validate input. 280 285 */ 281 if (!rtsemEventValid(EventSem)) 282 { 283 AssertMsgFailed(("Invalid handle %p!\n", EventSem)); 284 return VERR_INVALID_HANDLE; 285 } 286 struct RTSEMEVENTINTERNAL *pThis = EventSem; 287 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 288 uint32_t u32 = pThis->u32State; 289 AssertReturn(u32 == EVENT_STATE_NOT_SIGNALED || u32 == EVENT_STATE_SIGNALED, VERR_INVALID_HANDLE); 286 290 287 291 /* 288 292 * Timed or indefinite wait? 289 293 */ 290 struct RTSEMEVENTINTERNAL *pIntEventSem = EventSem;291 294 if (cMillies == RT_INDEFINITE_WAIT) 292 295 { 293 296 /* for fairness, yield before going to sleep. */ 294 if ( ASMAtomicIncU32(&p IntEventSem->cWaiters) > 1295 && p IntEventSem->u32State == EVENT_STATE_SIGNALED)297 if ( ASMAtomicIncU32(&pThis->cWaiters) > 1 298 && pThis->u32State == EVENT_STATE_SIGNALED) 296 299 pthread_yield(); 297 300 298 301 /* take mutex */ 299 int rc = pthread_mutex_lock(&p IntEventSem->Mutex);302 int rc = pthread_mutex_lock(&pThis->Mutex); 300 303 if (rc) 301 304 { 302 ASMAtomicDecU32(&p IntEventSem->cWaiters);305 ASMAtomicDecU32(&pThis->cWaiters); 303 306 AssertMsgFailed(("Failed to lock event sem %p, rc=%d.\n", EventSem, rc)); 304 307 return RTErrConvertFromErrno(rc); … … 308 311 { 309 312 /* check state. */ 310 if (p IntEventSem->u32State == EVENT_STATE_SIGNALED)311 { 312 ASMAtomicXchgU32(&p IntEventSem->u32State, EVENT_STATE_NOT_SIGNALED);313 ASMAtomicDecU32(&p IntEventSem->cWaiters);314 rc = pthread_mutex_unlock(&p IntEventSem->Mutex);313 if (pThis->u32State == EVENT_STATE_SIGNALED) 314 { 315 ASMAtomicXchgU32(&pThis->u32State, EVENT_STATE_NOT_SIGNALED); 316 ASMAtomicDecU32(&pThis->cWaiters); 317 rc = pthread_mutex_unlock(&pThis->Mutex); 315 318 AssertMsg(!rc, ("Failed to unlock event sem %p, rc=%d.\n", EventSem, rc)); NOREF(rc); 316 319 return VINF_SUCCESS; 317 320 } 318 if (p IntEventSem->u32State == EVENT_STATE_UNINITIALIZED)319 { 320 rc = pthread_mutex_unlock(&p IntEventSem->Mutex);321 if (pThis->u32State == EVENT_STATE_UNINITIALIZED) 322 { 323 rc = pthread_mutex_unlock(&pThis->Mutex); 321 324 AssertMsg(!rc, ("Failed to unlock event sem %p, rc=%d.\n", EventSem, rc)); NOREF(rc); 322 325 return VERR_SEM_DESTROYED; … … 324 327 325 328 /* wait */ 326 rc = pthread_cond_wait(&pIntEventSem->Cond, &pIntEventSem->Mutex); 329 #ifdef RTSEMEVENT_STRICT 330 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 331 if (pThis->fEverHadSignallers) 332 { 333 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 334 RTTHREADSTATE_EVENT, true); 335 if (RT_FAILURE(rc)) 336 { 337 ASMAtomicDecU32(&pThis->cWaiters); 338 pthread_mutex_unlock(&pThis->Mutex); 339 return rc; 340 } 341 } 342 #else 343 RTTHREAD hThreadSelf = RTThreadSelf(); 344 #endif 345 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_EVENT, true); 346 rc = pthread_cond_wait(&pThis->Cond, &pThis->Mutex); 347 RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_EVENT); 327 348 if (rc) 328 349 { 329 350 AssertMsgFailed(("Failed to wait on event sem %p, rc=%d.\n", EventSem, rc)); 330 ASMAtomicDecU32(&p IntEventSem->cWaiters);331 int rc2 = pthread_mutex_unlock(&p IntEventSem->Mutex);351 ASMAtomicDecU32(&pThis->cWaiters); 352 int rc2 = pthread_mutex_unlock(&pThis->Mutex); 332 353 AssertMsg(!rc2, ("Failed to unlock event sem %p, rc=%d.\n", EventSem, rc2)); NOREF(rc2); 333 354 return RTErrConvertFromErrno(rc); … … 361 382 362 383 /* for fairness, yield before going to sleep. */ 363 if (ASMAtomicIncU32(&p IntEventSem->cWaiters) > 1)384 if (ASMAtomicIncU32(&pThis->cWaiters) > 1 && cMillies) 364 385 pthread_yield(); 365 386 366 387 /* take mutex */ 367 #ifdef RT_OS_DARWIN 368 int rc = pthread_mutex_lock(&pIntEventSem->Mutex); 369 #else 370 int rc = pthread_mutex_timedlock(&pIntEventSem->Mutex, &ts); 371 #endif 388 int rc = pthread_mutex_lock(&pThis->Mutex); 372 389 if (rc) 373 390 { 374 ASMAtomicDecU32(&p IntEventSem->cWaiters);391 ASMAtomicDecU32(&pThis->cWaiters); 375 392 AssertMsg(rc == ETIMEDOUT, ("Failed to lock event sem %p, rc=%d.\n", EventSem, rc)); 376 393 return RTErrConvertFromErrno(rc); … … 380 397 { 381 398 /* check state. */ 382 if (p IntEventSem->u32State == EVENT_STATE_SIGNALED)383 { 384 ASMAtomicXchgU32(&p IntEventSem->u32State, EVENT_STATE_NOT_SIGNALED);385 ASMAtomicDecU32(&p IntEventSem->cWaiters);386 rc = pthread_mutex_unlock(&p IntEventSem->Mutex);399 if (pThis->u32State == EVENT_STATE_SIGNALED) 400 { 401 ASMAtomicXchgU32(&pThis->u32State, EVENT_STATE_NOT_SIGNALED); 402 ASMAtomicDecU32(&pThis->cWaiters); 403 rc = pthread_mutex_unlock(&pThis->Mutex); 387 404 AssertMsg(!rc, ("Failed to unlock event sem %p, rc=%d.\n", EventSem, rc)); NOREF(rc); 388 405 return VINF_SUCCESS; 389 406 } 390 if (p IntEventSem->u32State == EVENT_STATE_UNINITIALIZED)391 { 392 rc = pthread_mutex_unlock(&p IntEventSem->Mutex);407 if (pThis->u32State == EVENT_STATE_UNINITIALIZED) 408 { 409 rc = pthread_mutex_unlock(&pThis->Mutex); 393 410 AssertMsg(!rc, ("Failed to unlock event sem %p, rc=%d.\n", EventSem, rc)); NOREF(rc); 394 411 return VERR_SEM_DESTROYED; 395 412 } 396 413 414 /* we're done if the timeout is 0. */ 415 if (!cMillies) 416 { 417 ASMAtomicDecU32(&pThis->cWaiters); 418 rc = pthread_mutex_unlock(&pThis->Mutex); 419 return VERR_SEM_BUSY; 420 } 421 397 422 /* wait */ 398 rc = pthread_cond_timedwait(&pIntEventSem->Cond, &pIntEventSem->Mutex, &ts); 423 #ifdef RTSEMEVENT_STRICT 424 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 425 if (pThis->fEverHadSignallers) 426 { 427 rc = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false, 428 RTTHREADSTATE_EVENT, true); 429 if (RT_FAILURE(rc)) 430 { 431 ASMAtomicDecU32(&pThis->cWaiters); 432 pthread_mutex_unlock(&pThis->Mutex); 433 return rc; 434 } 435 } 436 #else 437 RTTHREAD hThreadSelf = RTThreadSelf(); 438 #endif 439 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_EVENT, true); 440 rc = pthread_cond_timedwait(&pThis->Cond, &pThis->Mutex, &ts); 441 RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_EVENT); 399 442 if (rc && (rc != EINTR || !fAutoResume)) /* according to SuS this function shall not return EINTR, but linux man page says differently. */ 400 443 { 401 444 AssertMsg(rc == ETIMEDOUT, ("Failed to wait on event sem %p, rc=%d.\n", EventSem, rc)); 402 ASMAtomicDecU32(&p IntEventSem->cWaiters);403 int rc2 = pthread_mutex_unlock(&p IntEventSem->Mutex);445 ASMAtomicDecU32(&pThis->cWaiters); 446 int rc2 = pthread_mutex_unlock(&pThis->Mutex); 404 447 AssertMsg(!rc2, ("Failed to unlock event sem %p, rc2=%d.\n", EventSem, rc2)); NOREF(rc2); 405 448 return RTErrConvertFromErrno(rc); … … 423 466 } 424 467 468 469 RTDECL(void) RTSemEventSetSignaller(RTSEMEVENT hEventSem, RTTHREAD hThread) 470 { 471 #ifdef RTSEMEVENT_STRICT 472 struct RTSEMEVENTINTERNAL *pThis = hEventSem; 473 AssertPtrReturnVoid(pThis); 474 uint32_t u32 = pThis->u32State; 475 AssertReturnVoid(u32 == EVENT_STATE_NOT_SIGNALED || u32 == EVENT_STATE_SIGNALED); 476 477 ASMAtomicWriteBool(&pThis->fEverHadSignallers, true); 478 RTLockValidatorRecSharedResetOwner(&pThis->Signallers, hThread, NULL); 479 #endif 480 } 481 482 483 RTDECL(void) RTSemEventAddSignaller(RTSEMEVENT hEventSem, RTTHREAD hThread) 484 { 485 #ifdef RTSEMEVENT_STRICT 486 struct RTSEMEVENTINTERNAL *pThis = hEventSem; 487 AssertPtrReturnVoid(pThis); 488 uint32_t u32 = pThis->u32State; 489 AssertReturnVoid(u32 == EVENT_STATE_NOT_SIGNALED || u32 == EVENT_STATE_SIGNALED); 490 491 ASMAtomicWriteBool(&pThis->fEverHadSignallers, true); 492 RTLockValidatorRecSharedAddOwner(&pThis->Signallers, hThread, NULL); 493 #endif 494 } 495 496 497 RTDECL(void) RTSemEventRemoveSignaller(RTSEMEVENT hEventSem, RTTHREAD hThread) 498 { 499 #ifdef RTSEMEVENT_STRICT 500 struct RTSEMEVENTINTERNAL *pThis = hEventSem; 501 AssertPtrReturnVoid(pThis); 502 uint32_t u32 = pThis->u32State; 503 AssertReturnVoid(u32 == EVENT_STATE_NOT_SIGNALED || u32 == EVENT_STATE_SIGNALED); 504 505 RTLockValidatorRecSharedRemoveOwner(&pThis->Signallers, hThread); 506 #endif 507 } 508 -
trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
r25628 r25638 188 188 #ifdef RTSEMMUTEX_STRICT 189 189 hThreadSelf = RTThreadSelfAutoAdopt(); 190 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true, RTTHREADSTATE_MUTEX); 190 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true, 191 RTTHREADSTATE_MUTEX, true); 191 192 if (RT_FAILURE(rc9)) 192 193 return rc9; 193 194 #else 194 195 hThreadSelf = RTThreadSelf(); 195 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX );196 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_MUTEX, true); 196 197 #endif 197 198 } -
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25620 r25638 127 127 #ifdef RTSEMRW_STRICT 128 128 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis); 129 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis );129 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/); 130 130 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 131 131 #endif … … 224 224 #ifdef RTSEMRW_STRICT 225 225 hThreadSelf = RTThreadSelfAutoAdopt(); 226 int rc9 = RTLockValidatorRecSharedCheckOrderAndBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true, RTTHREADSTATE_RW_READ); 226 int rc9 = RTLockValidatorRecSharedCheckOrderAndBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true, 227 RTTHREADSTATE_RW_READ, true); 227 228 if (RT_FAILURE(rc9)) 228 229 return rc9; 229 230 #else 230 231 hThreadSelf = RTThreadSelf(); 231 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_READ );232 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_READ, true); 232 233 #endif 233 234 } … … 280 281 ASMAtomicIncU32(&pThis->cReaders); 281 282 #ifdef RTSEMRW_STRICT 282 RTLockValidator SharedRecAddOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos);283 RTLockValidatorRecSharedAddOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos); 283 284 #endif 284 285 return VINF_SUCCESS; … … 416 417 #ifdef RTSEMRW_STRICT 417 418 hThreadSelf = RTThreadSelfAutoAdopt(); 418 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true, RTTHREADSTATE_RW_WRITE); 419 int rc9 = RTLockValidatorRecExclCheckOrderAndBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true, 420 RTTHREADSTATE_RW_WRITE, true); 419 421 if (RT_FAILURE(rc9)) 420 422 return rc9; 421 423 #else 422 424 hThreadSelf = RTThreadSelf(); 423 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE );425 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE, true); 424 426 #endif 425 427 } -
trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp
r13837 r25638 37 37 #include <pthread.h> 38 38 #include <signal.h> 39 #if defined(RT_OS_LINUX) 40 # include <unistd.h> 41 # include <sys/syscall.h> 42 #endif 39 43 #if defined(RT_OS_SOLARIS) 40 44 # include <sched.h> … … 170 174 PRTTHREADINT pThread = (PRTTHREADINT)pvArgs; 171 175 176 #if defined(RT_OS_LINUX) 177 /* 178 * Set the TID. 179 */ 180 pThread->tid = syscall(__NR_gettid); 181 ASMMemoryFence(); 182 #endif 183 172 184 /* 173 185 * Block SIGALRM - required for timer-posix.cpp. … … 204 216 if (!pThread->cbStack) 205 217 pThread->cbStack = 512*1024; 218 219 #ifdef RT_OS_LINUX 220 pThread->tid = -1; 221 #endif 206 222 207 223 /*
Note:
See TracChangeset
for help on using the changeset viewer.