summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlfb <lfb>1999-03-09 01:51:26 (GMT)
committerlfb <lfb>1999-03-09 01:51:26 (GMT)
commit67ae76325007eb43f2ecdf17db443059c86cb54f (patch)
tree4f36283298d3e3a7ffd442169f291fdd3180ba41
parentfc7fc30bb7804077e6320e54b74913e759361a8b (diff)
downloadtk-67ae76325007eb43f2ecdf17db443059c86cb54f.zip
tk-67ae76325007eb43f2ecdf17db443059c86cb54f.tar.gz
tk-67ae76325007eb43f2ecdf17db443059c86cb54f.tar.bz2
Added call to TkpMenuThread Init for thread-specific menu initialization.
-rw-r--r--generic/tkMenu.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 4100620..a4a89b2 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMenu.c,v 1.1.4.6 1999/02/11 04:13:46 stanton Exp $
+ * RCS: @(#) $Id: tkMenu.c,v 1.1.4.7 1999/03/09 01:51:26 lfb Exp $
*/
/*
@@ -74,8 +74,21 @@
#define MENU_HASH_KEY "tkMenus"
-static int menusInitialized; /* Whether or not the hash tables, etc., have
- * been setup */
+typedef struct ThreadSpecificData {
+ int menusInitialized; /* Flag indicates whether thread-specific
+ * elements of the Windows Menu module
+ * have been initialized. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
+
+/*
+ * The following flag indicates whether the process-wide state for
+ * the Menu module has been intialized. The Mutex protects access to
+ * that flag.
+ */
+
+static int menusInitialized;
+TCL_DECLARE_MUTEX(menuMutex)
/*
* Configuration specs for individual menu entries. If this changes, be sure
@@ -3413,8 +3426,19 @@ DeleteMenuCloneEntries(menuPtr, first, last)
void
TkMenuInit()
{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
if (!menusInitialized) {
- TkpMenuInit();
- menusInitialized = 1;
+ Tcl_MutexLock(&menuMutex);
+ if (!menusInitialized) {
+ TkpMenuInit();
+ menusInitialized = 1;
+ }
+ Tcl_MutexUnlock(&menuMutex);
+ }
+ if (!tsdPtr->menusInitialized) {
+ TkpMenuThreadInit();
+ tsdPtr->menusInitialized = 1;
}
}