HTML_Lectures/Virtualization_Lecture/vbox/src/VBox/Frontends/VirtualBox/src/main.cpp
/** X11: For versions of Xlib which are aware of multi-threaded environments this function
  *      calls for XInitThreads() which initializes Xlib support for concurrent threads.
  * @returns @c non-zero unless it is unsafe to make multi-threaded calls to Xlib.
  * @remarks This is a workaround for a bug on old Xlib versions, fixed in commit
  *          941f02e and released in Xlib version 1.1. We check for the symbol
  *          "xcb_connect" which was introduced in that version. */
For versions of Xlib which are aware of multi-threaded environments this function
calls for XInitThreads() which initializes Xlib support for concurrent threads.
@returns @c non-zero unless it is unsafe to make multi-threaded calls to Xlib.
@remarks This is a workaround for a bug on old Xlib versions, fixed in commit
941f02e and released in Xlib version 1.1. We check for the symbol
"xcb_connect" which was introduced in that version.
For versions of Xlib which are aware of multi - threaded environments this function calls for XInitThreads () which initializes Xlib support for concurrent threads . @returns @c non - zero unless it is unsafe to make multi - threaded calls to Xlib . @remarks This is a workaround for a bug on old Xlib versions fixed in commit 941f02e and released in Xlib version 1 . 1 . We check for the symbol " xcb_connect " which was introduced in that version .
static Status MakeSureMultiThreadingIsSafe()
{
    Status rc = 1;
    void *pvProcess = dlopen(0, RTLD_GLOBAL | RTLD_LAZY);
    if (pvProcess && dlsym(pvProcess, "xcb_connect"))
        rc = XInitThreads();
    if (pvProcess)
        dlclose(pvProcess);
    return rc;
}
static Status MakeSureMultiThreadingIsSafe ( ) { Status rc = 1 ; void * pvProcess = dlopen ( 0 , RTLD_GLOBAL | RTLD_LAZY ) ; if ( pvProcess && dlsym ( pvProcess , " " ) ) rc = XInitThreads ( ) ; if ( pvProcess ) dlclose ( pvProcess ) ; return rc ; }
X11: For versions of Xlib which are aware of multi-threaded environments this function
      calls for XInitThreads() which initializes Xlib support for concurrent threads.
X11 : For versions of Xlib which are aware of multi - threaded environments this function calls for XInitThreads () which initializes Xlib support for concurrent threads .
/* Success by default: */ /* Get a global handle to process symbols: */ /* Initialize multi-thread environment only if we can obtain
     * an address of xcb_connect symbol in this process: */ /* Close the handle: */ /* Return result: */