Changeset 52623 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Sep 5, 2014 7:14:21 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp
r52622 r52623 51 51 on startup. */ 52 52 53 static bool volatile fState = false; 54 if (!ASMAtomicCmpXchgBool(&fState, true, false)) 53 #define VBOX_OGL_CHECK_UNINITIALIZED (0) 54 #define VBOX_OGL_CHECK_INITIALIZING (1) 55 #define VBOX_OGL_CHECK_INITIALIZED (2) 56 57 /* Transition VBOX_OGL_CHECK_UNINITIALIZED -> VBOX_OGL_CHECK_INITIALIZING means the current thread 58 is the first one who entered the routine. In this case, it should detect number of GPUs, cache result 59 and return it. If it's not TRUE, then fInitialized is VBOX_OGL_CHECK_INITIALIZING (another thread is performing 60 the check; current thread should wait till result will be cached and return it) or VBOX_OGL_CHECK_INITIALIZED 61 (result is already cached; just return it.) */ 62 63 static uint8_t volatile fInitialized = VBOX_OGL_CHECK_UNINITIALIZED; 64 if (!ASMAtomicCmpXchgU8(&fInitialized, VBOX_OGL_CHECK_INITIALIZING, VBOX_OGL_CHECK_UNINITIALIZED)) 55 65 { 56 while (ASMAtomicRead Bool(&fState) != true)66 while (ASMAtomicReadU8(&fInitialized) != VBOX_OGL_CHECK_INITIALIZED) 57 67 RTThreadSleep(5); 58 68 … … 94 104 95 105 LogRel(("OpenGL: Offline rendering support is %s (PID=%d)\n", fAppropriate ? "ON" : "OFF", (int)getpid())); 106 107 ASMAtomicWriteU8(&fInitialized, VBOX_OGL_CHECK_INITIALIZED); 96 108 97 109 return fAppropriate;
Note:
See TracChangeset
for help on using the changeset viewer.