diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-25 20:33:58 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-25 20:33:58 (GMT) |
commit | 54a771e501da6a4560e298e70c348ae4c3961e7f (patch) | |
tree | 12c04709beef499935e21f177476a8bf54f4bed6 /unix | |
parent | fee86da1c91ba1bfae832ba669b288bb7bb7ddfc (diff) | |
download | tk-54a771e501da6a4560e298e70c348ae4c3961e7f.zip tk-54a771e501da6a4560e298e70c348ae4c3961e7f.tar.gz tk-54a771e501da6a4560e298e70c348ae4c3961e7f.tar.bz2 |
Put mutex around XInitThreads call, making sure it is only called once.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixEvent.c | 15 |
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 |