Tcl Source Code

Check-in [d7c93731e2]
Login

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

Overview
Comment:Workaround for [414d10346b]: tcl 8.5.15/8.6.1(threaded build) hangs in exec on HP-UX
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: d7c93731e2ef05f7f1f98ed373e1b3f1b1edab62
User & Date: jan.nijtmans 2013-10-29 08:15:36
References
2013-11-11
12:18 Pending ticket [414d10346b]: tcl 8.5.15/8.6.1(threaded build) hangs in exec on HP-UX plus 5 other changes artifact: e56ef8bfb7 user: jan.nijtmans
Context
2013-11-04
10:02
Put extern "C" guards around all stub table struct definitions, so it is usable for C++ compilers as... check-in: e0986c290f user: jan.nijtmans tags: core-8-5-branch
2013-10-29
08:17
Workaround for [414d10346b]: tcl 8.5.15/8.6.1(threaded build) hangs in exec on HP-UX check-in: 6ba84ab753 user: jan.nijtmans tags: trunk
08:15
Workaround for [414d10346b]: tcl 8.5.15/8.6.1(threaded build) hangs in exec on HP-UX check-in: d7c93731e2 user: jan.nijtmans tags: core-8-5-branch
2013-10-28
10:55
Bump tcltest version to 2.3.6 (should have been done just before the 8.5.15 release, just as in Tcl ... check-in: a803608ed5 user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to unix/tclUnixNotfy.c.

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

/*
 * Static routines defined in this file.
 */

#ifdef TCL_THREADS
static void	NotifierThreadProc(ClientData clientData);
#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__)
static int	atForkInit = 0;
static void	AtForkPrepare(void);
static void	AtForkParent(void);
static void	AtForkChild(void);
#endif /* HAVE_PTHREAD_ATFORK */
#endif /* TCL_THREADS */
static int	FileHandlerEventProc(Tcl_Event *evPtr, int flags);







|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

/*
 * Static routines defined in this file.
 */

#ifdef TCL_THREADS
static void	NotifierThreadProc(ClientData clientData);
#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux)
static int	atForkInit = 0;
static void	AtForkPrepare(void);
static void	AtForkParent(void);
static void	AtForkChild(void);
#endif /* HAVE_PTHREAD_ATFORK */
#endif /* TCL_THREADS */
static int	FileHandlerEventProc(Tcl_Event *evPtr, int flags);
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
    tsdPtr->eventReady = 0;

    /*
     * Start the Notifier thread if necessary.
     */

    Tcl_MutexLock(&notifierMutex);
#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__)
    /*
     * Install pthread_atfork handlers to reinitialize the notifier in the
     * child of a fork.
     */

    if (!atForkInit) {
	int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild);







|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
    tsdPtr->eventReady = 0;

    /*
     * Start the Notifier thread if necessary.
     */

    Tcl_MutexLock(&notifierMutex);
#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux)
    /*
     * Install pthread_atfork handlers to reinitialize the notifier in the
     * child of a fork.
     */

    if (!atForkInit) {
	int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild);
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
    triggerPipe = -1;
    Tcl_ConditionNotify(&notifierCV);
    Tcl_MutexUnlock(&notifierMutex);

    TclpThreadExit (0);
}

#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__)
/*
 *----------------------------------------------------------------------
 *
 * AtForkPrepare --
 *
 *	Lock the notifier in preparation for a fork.
 *







|







1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
    triggerPipe = -1;
    Tcl_ConditionNotify(&notifierCV);
    Tcl_MutexUnlock(&notifierMutex);

    TclpThreadExit (0);
}

#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux)
/*
 *----------------------------------------------------------------------
 *
 * AtForkPrepare --
 *
 *	Lock the notifier in preparation for a fork.
 *

Changes to unix/tclUnixTest.c.

570
571
572
573
574
575
576
577
578

579
580
581
582
583
584
585
586
587
588
589
    }
    pid = fork();
    if (pid == -1) {
        Tcl_AppendResult(interp,
                "Cannot fork", NULL);
        return TCL_ERROR;
    }
#if !defined(HAVE_PTHREAD_ATFORK)
    /* Only needed when pthread_atfork is not present. */

    if (pid==0) {
	Tcl_InitNotifier();
    }
#endif
    Tcl_SetObjResult(interp, Tcl_NewIntObj(pid));
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *







<
|
>



<







570
571
572
573
574
575
576

577
578
579
580
581

582
583
584
585
586
587
588
    }
    pid = fork();
    if (pid == -1) {
        Tcl_AppendResult(interp,
                "Cannot fork", NULL);
        return TCL_ERROR;
    }

    /* Only needed when pthread_atfork is not present,
     * should not hurt otherwise. */
    if (pid==0) {
	Tcl_InitNotifier();
    }

    Tcl_SetObjResult(interp, Tcl_NewIntObj(pid));
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *