summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tkUnixEvent.c')
-rw-r--r--unix/tkUnixEvent.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 6268b25..c540157 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -119,13 +119,18 @@ TkpOpenDisplay(
Display *display;
#ifdef TCL_THREADS
static int xinited = 0;
+ TCL_DECLARE_MUTEX(xinitMutex);
if (!xinited) {
- /* Necessary for threaded apps, of no consequence otherwise */
- /* need only be called once, but must be called before *any* */
- /* Xlib call is made. */
- XInitThreads();
- xinited = 1;
+ Tcl_MutexLock(&xinitMutex);
+ if (!xinited) {
+ /* Necessary for threaded apps, of no consequence otherwise */
+ /* need only be called once, but must be called before *any* */
+ /* Xlib call is made. */
+ XInitThreads();
+ xinited = 1;
+ }
+ Tcl_MutexUnlock(&xinitMutex);
}
#endif