Changeset 32832 in vbox
- Timestamp:
- Sep 29, 2010 9:11:30 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 66291
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/main.cpp
r28800 r32832 27 27 #include <X11/Xlib.h> 28 28 29 #include <iprt/critsect.h> 29 30 #include <iprt/env.h> 30 31 #include <iprt/initterm.h> … … 51 52 * cleanup routine. */ 52 53 static RTFILE g_hPidFile; 54 /** Global critical section used to protect the clean-up routine, which can be 55 * called from different threads. 56 */ 57 RTCRITSECT g_critSect; 53 58 54 59 /** Clean up if we get a signal or something. This is extern so that we … … 56 61 void VBoxClient::CleanUp() 57 62 { 63 /* We never release this, as we end up with a call to exit(3) which is not 64 * async-safe. Until we fix this application properly, we should be sure 65 * never to exit from anywhere except from this method. */ 66 int rc = RTCritSectEnter(&g_critSect); 67 if (RT_FAILURE(rc)) 68 { 69 RTPrintf("VBoxClient: Failure while acquiring the global critical section, rc=%Rrc\n", rc); 70 _Exit(1); 71 } 58 72 if (g_pService) 59 73 { … … 149 163 int main(int argc, char *argv[]) 150 164 { 151 int rcClipboard, rc = VINF_SUCCESS;165 int rcClipboard, rc; 152 166 const char *pszFileName = RTPathFilename(argv[0]); 153 167 bool fDaemonise = true; … … 161 175 162 176 /* Initialise our runtime before all else. */ 163 RTR3Init(); 177 rc = RTR3Init(); 178 if (RT_FAILURE(rc)) 179 { 180 /* Of course, this should never happen. */ 181 RTPrintf("%s: Failed to initialise the run-time library, rc=%Rrc\n", pszFileName, rc); 182 exit(1); 183 } 184 185 /* Initialise our global clean-up critical section */ 186 rc = RTCritSectInit(&g_critSect); 187 if (RT_FAILURE(rc)) 188 { 189 /* Of course, this should never happen. */ 190 RTPrintf("%s: Failed to initialise the global critical section, rc=%Rrc\n", pszFileName, rc); 191 exit(1); 192 } 164 193 165 194 /* Parse our option(s) */
Note:
See TracChangeset
for help on using the changeset viewer.