Changeset 25381 in vbox for trunk/src/VBox/Runtime/generic
- Timestamp:
- Dec 14, 2009 11:52:28 PM (15 years ago)
- 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 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Generic Non-Interruptable Wait and Request Functions.3 * IPRT - RTSemEventMultiWait, generic RTSemEventMultiWaitNoResume wrapper. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.7 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 42 42 43 43 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 */ 73 45 RTDECL(int) RTSemEventMultiWait(RTSEMEVENTMULTI EventSem, unsigned cMillies) 74 46 { … … 98 70 RT_EXPORT_SYMBOL(RTSemEventMultiWait); 99 71 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 else111 {112 const uint64_t u64Start = RTTimeMilliTS();113 rc = RTSemMutexRequestNoResume(Mutex, cMillies);114 if (rc == VERR_INTERRUPTED)115 {116 do117 {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 else139 {140 const uint64_t u64Start = RTTimeMilliTS();141 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);142 if (rc == VERR_INTERRUPTED)143 {144 do145 {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 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Generic Non-Interruptable Wait and Request Functions.3 * IPRT - RTSemEventWait, generic RTSemEventWaitNoResume wrapper. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.7 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 42 42 43 43 44 44 #undef RTSemEventWait /* undo debug mapping */ 45 45 RTDECL(int) RTSemEventWait(RTSEMEVENT EventSem, unsigned cMillies) 46 46 { … … 70 70 RT_EXPORT_SYMBOL(RTSemEventWait); 71 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 else82 {83 const uint64_t u64Start = RTTimeMilliTS();84 rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);85 if (rc == VERR_INTERRUPTED)86 {87 do88 {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 else111 {112 const uint64_t u64Start = RTTimeMilliTS();113 rc = RTSemMutexRequestNoResume(Mutex, cMillies);114 if (rc == VERR_INTERRUPTED)115 {116 do117 {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 else139 {140 const uint64_t u64Start = RTTimeMilliTS();141 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);142 if (rc == VERR_INTERRUPTED)143 {144 do145 {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 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Generic Non-Interruptable Wait and Request Functions.3 * IPRT - RTSemMutexRequest, generic RTSemMutexRequestNoResume wrapper. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.7 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 42 42 43 43 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 else54 {55 const uint64_t u64Start = RTTimeMilliTS();56 rc = RTSemEventWaitNoResume(EventSem, cMillies);57 if (rc == VERR_INTERRUPTED)58 {59 do60 {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 else82 {83 const uint64_t u64Start = RTTimeMilliTS();84 rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);85 if (rc == VERR_INTERRUPTED)86 {87 do88 {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 44 #undef RTSemMutexRequest /* undo debug mapping */ 102 45 RTDECL(int) RTSemMutexRequest(RTSEMMUTEX Mutex, unsigned cMillies) … … 127 70 RT_EXPORT_SYMBOL(RTSemMutexRequest); 128 71 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 else139 {140 const uint64_t u64Start = RTTimeMilliTS();141 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS);142 if (rc == VERR_INTERRUPTED)143 {144 do145 {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 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Generic Non-Interruptable Wait and Request Functions.3 * IPRT - RTSemMutexRequestDebug, generic RTSemMutexRequestNoResumeDebug wrapper. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.7 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 44 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 else54 {55 const uint64_t u64Start = RTTimeMilliTS();56 rc = RTSemEventWaitNoResume(EventSem, cMillies);57 if (rc == VERR_INTERRUPTED)58 {59 do60 {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 else82 {83 const uint64_t u64Start = RTTimeMilliTS();84 rc = RTSemEventMultiWaitNoResume(EventSem, cMillies);85 if (rc == VERR_INTERRUPTED)86 {87 do88 {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 else111 {112 const uint64_t u64Start = RTTimeMilliTS();113 rc = RTSemMutexRequestNoResume(Mutex, cMillies);114 if (rc == VERR_INTERRUPTED)115 {116 do117 {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 45 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX Mutex, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 131 46 {
Note:
See TracChangeset
for help on using the changeset viewer.