Skip to content

Commit bafb0ac

Browse files
committed
x11display: add x-init-threads var to call XInitThreads()
This is off by default, but could be used if you stumble upon a race condition issue with X11 and threading.
1 parent 8ad0cb6 commit bafb0ac

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

panda/src/x11display/config_x11display.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ ConfigVariableBool x_error_abort
4040
"of an error from the X window system. This can make it easier "
4141
"to discover where these errors are generated."));
4242

43+
ConfigVariableBool x_init_threads
44+
("x-init-threads", false,
45+
PRC_DESC("Set this true to ask Panda3D to call XInitThreads() upon loading "
46+
"the display module, which may help with some threading issues."));
47+
4348
ConfigVariableInt x_wheel_up_button
4449
("x-wheel-up-button", 4,
4550
PRC_DESC("This is the mouse button index of the wheel_up event: which "

panda/src/x11display/config_x11display.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern EXPCL_PANDAX11 void init_libx11display();
2626

2727
extern ConfigVariableString display_cfg;
2828
extern ConfigVariableBool x_error_abort;
29+
extern ConfigVariableBool x_init_threads;
2930

3031
extern ConfigVariableInt x_wheel_up_button;
3132
extern ConfigVariableInt x_wheel_down_button;

panda/src/x11display/x11GraphicsPipe.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ x11GraphicsPipe(const std::string &display) :
6666
_im = (XIM)nullptr;
6767
_hidden_cursor = None;
6868

69+
// According to the documentation, we should call this before making any
70+
// other Xlib calls if we wish to use the Xlib locking system.
71+
if (x_init_threads) {
72+
XInitThreads();
73+
}
74+
6975
install_error_handlers();
7076

7177
_display = XOpenDisplay(display_spec.c_str());

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy