VirtualBox

Changeset 25381 in vbox for trunk/src/VBox/Runtime/generic


Ignore:
Timestamp:
Dec 14, 2009 11:52:28 PM (15 years ago)
Author:
vboxsync
Message:

IPRT: Split up sems-win.cpp and semnoint-generic.cpp

Location:
trunk/src/VBox/Runtime/generic
Files:
3 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/RTSemEventMultiWait-generic.cpp

    r25379 r25381  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Generic Non-Interruptable Wait and Request Functions.
     3 * IPRT - RTSemEventMultiWait, generic RTSemEventMultiWaitNoResume wrapper.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4242
    4343
    44 
    45 RTDECL(int) RTSemEventWait(RTSEMEVENT EventSem, unsigned cMillies)
    46 {
    47     int rc;
    48     if (cMillies == RT_INDEFINITE_WAIT)
    49     {
    50         do rc = RTSemEventWaitNoResume(EventSem, cMillies);
    51         while (rc == VERR_INTERRUPTED);
    52     }
    53     else
    54     {
    55         const uint64_t u64Start = RTTimeMilliTS();
    56         rc = RTSemEventWaitNoResume(EventSem, cMillies);
    57         if (rc == VERR_INTERRUPTED)
    58         {
    59             do
    60             {
    61                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    62                 if (u64Elapsed >= cMillies)
    63                     return VERR_TIMEOUT;
    64                 rc = RTSemEventWaitNoResume(EventSem, cMillies - (unsigned)u64Elapsed);
    65             } while (rc == VERR_INTERRUPTED);
    66         }
    67     }
    68     return rc;
    69 }
    70 RT_EXPORT_SYMBOL(RTSemEventWait);
    71 
    72 
     44#undef RTSemEventMultiWait              /* undo debug mapping */
    7345RTDECL(int) RTSemEventMultiWait(RTSEMEVENTMULTI EventSem, unsigned cMillies)
    7446{
     
    9870RT_EXPORT_SYMBOL(RTSemEventMultiWait);
    9971
    100 
    101 #undef RTSemMutexRequest                /* undo debug mapping */
    102 RTDECL(int) RTSemMutexRequest(RTSEMMUTEX Mutex, unsigned cMillies)
    103 {
    104     int rc;
    105     if (cMillies == RT_INDEFINITE_WAIT)
    106     {
    107         do rc = RTSemMutexRequestNoResume(Mutex, cMillies);
    108         while (rc == VERR_INTERRUPTED);
    109     }
    110     else
    111     {
    112         const uint64_t u64Start = RTTimeMilliTS();
    113         rc = RTSemMutexRequestNoResume(Mutex, cMillies);
    114         if (rc == VERR_INTERRUPTED)
    115         {
    116             do
    117             {
    118                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    119                 if (u64Elapsed >= cMillies)
    120                     return VERR_TIMEOUT;
    121                 rc = RTSemMutexRequestNoResume(Mutex, cMillies - (unsigned)u64Elapsed);
    122             } while (rc == VERR_INTERRUPTED);
    123         }
    124     }
    125     return rc;
    126 }
    127 RT_EXPORT_SYMBOL(RTSemMutexRequest);
    128 
    129 
    130 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX Mutex, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    131 {
    132     int rc;
    133     if (cMillies == RT_INDEFINITE_WAIT)
    134     {
    135         do rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
    136         while (rc == VERR_INTERRUPTED);
    137     }
    138     else
    139     {
    140         const uint64_t u64Start = RTTimeMilliTS();
    141         rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
    142         if (rc == VERR_INTERRUPTED)
    143         {
    144             do
    145             {
    146                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    147                 if (u64Elapsed >= cMillies)
    148                     return VERR_TIMEOUT;
    149                 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies - (unsigned)u64Elapsed, uId, RT_SRC_POS_ARGS);
    150             } while (rc == VERR_INTERRUPTED);
    151         }
    152     }
    153     return rc;
    154 }
    155 RT_EXPORT_SYMBOL(RTSemMutexRequestDebug);
    156 
  • trunk/src/VBox/Runtime/generic/RTSemEventWait-generic.cpp

    r25379 r25381  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Generic Non-Interruptable Wait and Request Functions.
     3 * IPRT - RTSemEventWait, generic RTSemEventWaitNoResume wrapper.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4242
    4343
    44 
     44#undef RTSemEventWait                   /* undo debug mapping */
    4545RTDECL(int) RTSemEventWait(RTSEMEVENT EventSem, unsigned cMillies)
    4646{
     
    7070RT_EXPORT_SYMBOL(RTSemEventWait);
    7171
    72 
    73 RTDECL(int) RTSemEventMultiWait(RTSEMEVENTMULTI EventSem, unsigned cMillies)
    74 {
    75     int rc;
    76     if (cMillies == RT_INDEFINITE_WAIT)
    77     {
    78         do rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);
    79         while (rc == VERR_INTERRUPTED);
    80     }
    81     else
    82     {
    83         const uint64_t u64Start = RTTimeMilliTS();
    84         rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);
    85         if (rc == VERR_INTERRUPTED)
    86         {
    87             do
    88             {
    89                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    90                 if (u64Elapsed >= cMillies)
    91                     return VERR_TIMEOUT;
    92                 rc = RTSemEventMultiWaitNoResume(EventSem, cMillies - (unsigned)u64Elapsed);
    93             } while (rc == VERR_INTERRUPTED);
    94         }
    95     }
    96     return rc;
    97 }
    98 RT_EXPORT_SYMBOL(RTSemEventMultiWait);
    99 
    100 
    101 #undef RTSemMutexRequest                /* undo debug mapping */
    102 RTDECL(int) RTSemMutexRequest(RTSEMMUTEX Mutex, unsigned cMillies)
    103 {
    104     int rc;
    105     if (cMillies == RT_INDEFINITE_WAIT)
    106     {
    107         do rc = RTSemMutexRequestNoResume(Mutex, cMillies);
    108         while (rc == VERR_INTERRUPTED);
    109     }
    110     else
    111     {
    112         const uint64_t u64Start = RTTimeMilliTS();
    113         rc = RTSemMutexRequestNoResume(Mutex, cMillies);
    114         if (rc == VERR_INTERRUPTED)
    115         {
    116             do
    117             {
    118                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    119                 if (u64Elapsed >= cMillies)
    120                     return VERR_TIMEOUT;
    121                 rc = RTSemMutexRequestNoResume(Mutex, cMillies - (unsigned)u64Elapsed);
    122             } while (rc == VERR_INTERRUPTED);
    123         }
    124     }
    125     return rc;
    126 }
    127 RT_EXPORT_SYMBOL(RTSemMutexRequest);
    128 
    129 
    130 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX Mutex, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    131 {
    132     int rc;
    133     if (cMillies == RT_INDEFINITE_WAIT)
    134     {
    135         do rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
    136         while (rc == VERR_INTERRUPTED);
    137     }
    138     else
    139     {
    140         const uint64_t u64Start = RTTimeMilliTS();
    141         rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
    142         if (rc == VERR_INTERRUPTED)
    143         {
    144             do
    145             {
    146                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    147                 if (u64Elapsed >= cMillies)
    148                     return VERR_TIMEOUT;
    149                 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies - (unsigned)u64Elapsed, uId, RT_SRC_POS_ARGS);
    150             } while (rc == VERR_INTERRUPTED);
    151         }
    152     }
    153     return rc;
    154 }
    155 RT_EXPORT_SYMBOL(RTSemMutexRequestDebug);
    156 
  • trunk/src/VBox/Runtime/generic/RTSemMutexRequest-generic.cpp

    r25379 r25381  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Generic Non-Interruptable Wait and Request Functions.
     3 * IPRT - RTSemMutexRequest, generic RTSemMutexRequestNoResume wrapper.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4242
    4343
    44 
    45 RTDECL(int) RTSemEventWait(RTSEMEVENT EventSem, unsigned cMillies)
    46 {
    47     int rc;
    48     if (cMillies == RT_INDEFINITE_WAIT)
    49     {
    50         do rc = RTSemEventWaitNoResume(EventSem, cMillies);
    51         while (rc == VERR_INTERRUPTED);
    52     }
    53     else
    54     {
    55         const uint64_t u64Start = RTTimeMilliTS();
    56         rc = RTSemEventWaitNoResume(EventSem, cMillies);
    57         if (rc == VERR_INTERRUPTED)
    58         {
    59             do
    60             {
    61                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    62                 if (u64Elapsed >= cMillies)
    63                     return VERR_TIMEOUT;
    64                 rc = RTSemEventWaitNoResume(EventSem, cMillies - (unsigned)u64Elapsed);
    65             } while (rc == VERR_INTERRUPTED);
    66         }
    67     }
    68     return rc;
    69 }
    70 RT_EXPORT_SYMBOL(RTSemEventWait);
    71 
    72 
    73 RTDECL(int) RTSemEventMultiWait(RTSEMEVENTMULTI EventSem, unsigned cMillies)
    74 {
    75     int rc;
    76     if (cMillies == RT_INDEFINITE_WAIT)
    77     {
    78         do rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);
    79         while (rc == VERR_INTERRUPTED);
    80     }
    81     else
    82     {
    83         const uint64_t u64Start = RTTimeMilliTS();
    84         rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);
    85         if (rc == VERR_INTERRUPTED)
    86         {
    87             do
    88             {
    89                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    90                 if (u64Elapsed >= cMillies)
    91                     return VERR_TIMEOUT;
    92                 rc = RTSemEventMultiWaitNoResume(EventSem, cMillies - (unsigned)u64Elapsed);
    93             } while (rc == VERR_INTERRUPTED);
    94         }
    95     }
    96     return rc;
    97 }
    98 RT_EXPORT_SYMBOL(RTSemEventMultiWait);
    99 
    100 
    10144#undef RTSemMutexRequest                /* undo debug mapping */
    10245RTDECL(int) RTSemMutexRequest(RTSEMMUTEX Mutex, unsigned cMillies)
     
    12770RT_EXPORT_SYMBOL(RTSemMutexRequest);
    12871
    129 
    130 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX Mutex, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    131 {
    132     int rc;
    133     if (cMillies == RT_INDEFINITE_WAIT)
    134     {
    135         do rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
    136         while (rc == VERR_INTERRUPTED);
    137     }
    138     else
    139     {
    140         const uint64_t u64Start = RTTimeMilliTS();
    141         rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);
    142         if (rc == VERR_INTERRUPTED)
    143         {
    144             do
    145             {
    146                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    147                 if (u64Elapsed >= cMillies)
    148                     return VERR_TIMEOUT;
    149                 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies - (unsigned)u64Elapsed, uId, RT_SRC_POS_ARGS);
    150             } while (rc == VERR_INTERRUPTED);
    151         }
    152     }
    153     return rc;
    154 }
    155 RT_EXPORT_SYMBOL(RTSemMutexRequestDebug);
    156 
  • trunk/src/VBox/Runtime/generic/RTSemMutexRequestDebug-generic.cpp

    r25379 r25381  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Generic Non-Interruptable Wait and Request Functions.
     3 * IPRT - RTSemMutexRequestDebug, generic RTSemMutexRequestNoResumeDebug wrapper.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4343
    4444
    45 RTDECL(int) RTSemEventWait(RTSEMEVENT EventSem, unsigned cMillies)
    46 {
    47     int rc;
    48     if (cMillies == RT_INDEFINITE_WAIT)
    49     {
    50         do rc = RTSemEventWaitNoResume(EventSem, cMillies);
    51         while (rc == VERR_INTERRUPTED);
    52     }
    53     else
    54     {
    55         const uint64_t u64Start = RTTimeMilliTS();
    56         rc = RTSemEventWaitNoResume(EventSem, cMillies);
    57         if (rc == VERR_INTERRUPTED)
    58         {
    59             do
    60             {
    61                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    62                 if (u64Elapsed >= cMillies)
    63                     return VERR_TIMEOUT;
    64                 rc = RTSemEventWaitNoResume(EventSem, cMillies - (unsigned)u64Elapsed);
    65             } while (rc == VERR_INTERRUPTED);
    66         }
    67     }
    68     return rc;
    69 }
    70 RT_EXPORT_SYMBOL(RTSemEventWait);
    71 
    72 
    73 RTDECL(int) RTSemEventMultiWait(RTSEMEVENTMULTI EventSem, unsigned cMillies)
    74 {
    75     int rc;
    76     if (cMillies == RT_INDEFINITE_WAIT)
    77     {
    78         do rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);
    79         while (rc == VERR_INTERRUPTED);
    80     }
    81     else
    82     {
    83         const uint64_t u64Start = RTTimeMilliTS();
    84         rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);
    85         if (rc == VERR_INTERRUPTED)
    86         {
    87             do
    88             {
    89                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    90                 if (u64Elapsed >= cMillies)
    91                     return VERR_TIMEOUT;
    92                 rc = RTSemEventMultiWaitNoResume(EventSem, cMillies - (unsigned)u64Elapsed);
    93             } while (rc == VERR_INTERRUPTED);
    94         }
    95     }
    96     return rc;
    97 }
    98 RT_EXPORT_SYMBOL(RTSemEventMultiWait);
    99 
    100 
    101 #undef RTSemMutexRequest                /* undo debug mapping */
    102 RTDECL(int) RTSemMutexRequest(RTSEMMUTEX Mutex, unsigned cMillies)
    103 {
    104     int rc;
    105     if (cMillies == RT_INDEFINITE_WAIT)
    106     {
    107         do rc = RTSemMutexRequestNoResume(Mutex, cMillies);
    108         while (rc == VERR_INTERRUPTED);
    109     }
    110     else
    111     {
    112         const uint64_t u64Start = RTTimeMilliTS();
    113         rc = RTSemMutexRequestNoResume(Mutex, cMillies);
    114         if (rc == VERR_INTERRUPTED)
    115         {
    116             do
    117             {
    118                 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start;
    119                 if (u64Elapsed >= cMillies)
    120                     return VERR_TIMEOUT;
    121                 rc = RTSemMutexRequestNoResume(Mutex, cMillies - (unsigned)u64Elapsed);
    122             } while (rc == VERR_INTERRUPTED);
    123         }
    124     }
    125     return rc;
    126 }
    127 RT_EXPORT_SYMBOL(RTSemMutexRequest);
    128 
    129 
    13045RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX Mutex, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    13146{
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