Tk Source Code

Check-in [557c73ca]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Put mutex around XInitThreads call, making sure it is only called once.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 557c73caa32f4d5d9da9f0007f26fca8fd138a1b
User & Date: jan.nijtmans 2013-02-25 20:33:58
Context
2013-02-26
12:18
Remove unneeded SetOptionFromAny and SetTextIndexFromAny. They were only needed to prevent a panic in Tcl, but Tcl now generates a nice error-message in stead of panicing. check-in: b1a5b200 user: jan.nijtmans tags: trunk
2013-02-25
20:33
Put mutex around XInitThreads call, making sure it is only called once. check-in: 557c73ca user: jan.nijtmans tags: trunk
2013-02-22
09:30
Make sure the stubbed variants of Tcl_ObjSetVar2/Tcl_NewStringObj are never used in winMain.c/tkAppInit.c check-in: 34f2a92b user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to unix/tkUnixEvent.c.

115
116
117
118
119
120
121

122
123


124
125
126
127
128


129
130
131
132
133
134
135
TkpOpenDisplay(
    const char *displayNameStr)
{
    TkDisplay *dispPtr;
    Display *display;
#ifdef TCL_THREADS
    static int xinited = 0;


    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;


    }
#endif

    display = XOpenDisplay(displayNameStr);
    if (display == NULL) {
	return NULL;
    }







>


>
>
|
|
|
|
|
>
>







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
TkpOpenDisplay(
    const char *displayNameStr)
{
    TkDisplay *dispPtr;
    Display *display;
#ifdef TCL_THREADS
    static int xinited = 0;
    TCL_DECLARE_MUTEX(xinitMutex);

    if (!xinited) {
	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

    display = XOpenDisplay(displayNameStr);
    if (display == NULL) {
	return NULL;
    }