VirtualBox

Changeset 5324 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Oct 16, 2007 11:51:49 AM (17 years ago)
Author:
vboxsync
Message:

removed the sizeof(pthread_t) == sizeof(void *) assumption.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/sems-posix.cpp

    r4071 r5324  
    725725                pthread_mutexattr_destroy(&MutexAttr);
    726726
    727                 pIntMutexSem->Owner    = (pthread_t)~0;
     727                pIntMutexSem->Owner    = ~(pthread_t)0;
    728728                pIntMutexSem->cNesting = 0;
    729729
     
    767767     * Free the memory and be gone.
    768768     */
    769     pIntMutexSem->Owner    = (pthread_t)~0;
     769    pIntMutexSem->Owner    = ~(pthread_t)0;
    770770    pIntMutexSem->cNesting = ~0;
    771771    RTMemTmpFree(pIntMutexSem);
     
    789789     * Check if nested request.
    790790     */
    791     pthread_t                       Self = pthread_self();
     791    pthread_t                     Self = pthread_self();
    792792    struct RTSEMMUTEXINTERNAL    *pIntMutexSem = MutexSem;
    793793    if (    pIntMutexSem->Owner == Self
     
    874874     * Check if nested.
    875875     */
    876     pthread_t                       Self = pthread_self();
     876    pthread_t                     Self = pthread_self();
    877877    struct RTSEMMUTEXINTERNAL    *pIntMutexSem = MutexSem;
    878878    if (    pIntMutexSem->Owner != Self
     
    896896     * Clear the state. (cNesting == 1)
    897897     */
    898     pIntMutexSem->Owner    = (pthread_t)~0;
     898    pIntMutexSem->Owner    = ~(pthread_t)0;
    899899    ASMAtomicXchgU32(&pIntMutexSem->cNesting, 0);
    900900
     
    956956            {
    957957                pIntRWSem->uCheck = ~0;
    958                 pIntRWSem->WROwner = (pthread_t)~0;
     958                pIntRWSem->WROwner = ~(pthread_t)0;
    959959                *pRWSem = pIntRWSem;
    960960                return VINF_SUCCESS;
     
    11601160    }
    11611161
    1162     ASMAtomicXchgPtr((void * volatile *)&pIntRWSem->WROwner, (void *)pthread_self());
     1162    ASMAtomicXchgSize(&pIntRWSem->WROwner, pthread_self());
    11631163
    11641164    return VINF_SUCCESS;
     
    11871187     * Try unlock it.
    11881188     */
    1189     pthread_t                   Self = pthread_self();
     1189    pthread_t                 Self = pthread_self();
    11901190    struct RTSEMRWINTERNAL   *pIntRWSem = RWSem;
    11911191    if (pIntRWSem->WROwner != Self)
     
    11981198     * Try unlock it.
    11991199     */
    1200     AssertMsg(sizeof(pthread_t) == sizeof(void *), ("pthread_t is not the size of a pointer but %d bytes\n", sizeof(pthread_t)));
    1201     ASMAtomicXchgPtr((void * volatile *)&pIntRWSem->WROwner, (void *)(uintptr_t)~0);
     1200    ASMAtomicXchgSize(&pIntRWSem->WROwner, ~(pthread_t)0);
    12021201    int rc = pthread_rwlock_unlock(&pIntRWSem->RWLock);
    12031202    if (rc)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette