Changeset 98472 in vbox for trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibPidFile.cpp
- Timestamp:
- Feb 3, 2023 6:56:59 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibPidFile.cpp
r98103 r98472 43 43 #include <iprt/string.h> 44 44 #include <iprt/process.h> 45 #include <iprt/err.h> 45 46 #include "VBoxGuestR3LibInternal.h" 47 48 /* A time to wait before starting the next attempt to check a pidfile. */ 49 #define VBGL_PIDFILE_WAIT_RELAX_TIME_MS (250) 46 50 47 51 /** … … 117 121 } 118 122 123 124 /** 125 * Wait for other process to release pidfile. 126 * 127 * This function is a wrapper to VbglR3PidFile(). 128 * 129 * @returns IPRT status code. 130 * @param szPidfile Path to pidfile. 131 * @param phPidfile Handle to pidfile. 132 * @param u64TimeoutMs A timeout value in milliseconds to wait for 133 * other process to release pidfile. 134 */ 135 VBGLR3DECL(int) VbglR3PidfileWait(const char *szPidfile, RTFILE *phPidfile, uint64_t u64TimeoutMs) 136 { 137 int rc = VERR_FILE_LOCK_VIOLATION; 138 uint64_t u64Start = RTTimeSystemMilliTS(); 139 140 AssertPtrReturn(szPidfile, VERR_INVALID_PARAMETER); 141 AssertPtrReturn(phPidfile, VERR_INVALID_PARAMETER); 142 143 while ( !RT_SUCCESS((rc = VbglR3PidFile(szPidfile, phPidfile))) 144 && (RTTimeSystemMilliTS() - u64Start < u64TimeoutMs)) 145 { 146 RTThreadSleep(VBGL_PIDFILE_WAIT_RELAX_TIME_MS); 147 } 148 149 return rc; 150 }
Note:
See TracChangeset
for help on using the changeset viewer.