Tcl Source Code

Check-in [067a0da5bb]
Login

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

Overview
Comment:Fix bug 1700, deadlock in notifier with threads enabled on Unix.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-1-branch-old
Files: files | file ages | folders
SHA1:067a0da5bbed6f31f092320d527bb66a0fd53134
User & Date: redman 1999-04-09 23:29:58
Context
1999-04-13
00:01
Doc bug fixes: Docs about APIs that dont exist were removed. Added example to catch ... check-in: d0a02d55eb user: surles tags: core-8-1-branch-old
1999-04-09
23:29
Fix bug 1700, deadlock in notifier with threads enabled on Unix. check-in: 067a0da5bb user: redman tags: core-8-1-branch-old
21:01
fix doc bugs 1739 & 1486 check-in: abf22092e0 user: surles tags: core-8-1-branch-old
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.









1
2
3
4
5
6
7







1999-04-06    <[email protected]>

	* tests/unixNotfy.test: Fixed hang in tests when built with thread
	support. 

	* tests/httpold.test: Fixed broken test that didn't wait long
	enough for events to arrive.
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1999-04-09    <[email protected]>

	* unix/tclUnixNotfy.c: Fixed notifier deadlock situation when the
	pipe used to talk back notifier thread is filled with data.  When
	calling the write() function to feed data down that pipe, unlock
	the notifierMutex to allow the notifier to wake up again.  Found
	as a result of the focus.test for Tk hanging. [Bug: 1700]

1999-04-06    <[email protected]>

	* tests/unixNotfy.test: Fixed hang in tests when built with thread
	support. 

	* tests/httpold.test: Fixed broken test that didn't wait long
	enough for events to arrive.

Changes to unix/tclUnixNotfy.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
686
687
688
689
690
691
692

693
694
695
696
697
698
699
700


701

702
703
704
705
706

707
708
709
710
711
712
713
...
722
723
724
725
726
727
728

729


730
731
732
733
734
735
736
 *	../generic/tclNotify.c.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUnixNotfy.c,v 1.1.2.9 1999/03/24 04:25:17 stanton Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#include <signal.h> 

/*
................................................................................

    if (waitForFiles) {
        /*
         * Add the ThreadSpecificData structure of this thread to the list
         * of ThreadSpecificData structures of all threads that are waiting
         * on file events.
         */


        tsdPtr->nextPtr = waitingListPtr;
        if (waitingListPtr) {
            waitingListPtr->prevPtr = tsdPtr;
        }
        tsdPtr->prevPtr = 0;
        waitingListPtr = tsdPtr;
	tsdPtr->onList = 1;


	write(triggerPipe, "", 1);

    }

    memset((VOID *) tsdPtr->readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask));

    if (!tsdPtr->eventReady) {

        Tcl_ConditionWait(&tsdPtr->waitCV, &notifierMutex, timePtr);
    }
    tsdPtr->eventReady = 0;

    if (waitForFiles && tsdPtr->onList) {
	/*
	 * Remove the ThreadSpecificData structure of this thread from the
................................................................................
            waitingListPtr = tsdPtr->nextPtr;
        }
        if (tsdPtr->nextPtr) {
            tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
        }
        tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
	tsdPtr->onList = 0;

	write(triggerPipe, "", 1);


    }

    
#else
    memcpy((VOID *) tsdPtr->readyMasks, (VOID *) tsdPtr->checkMasks,
	    3*MASK_SIZE*sizeof(fd_mask));
    numFound = select(tsdPtr->numFdBits,






|







 







>








>
>

>





>







 







>

>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
...
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
 *	../generic/tclNotify.c.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUnixNotfy.c,v 1.1.2.10 1999/04/09 23:30:01 redman Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#include <signal.h> 

/*
................................................................................

    if (waitForFiles) {
        /*
         * Add the ThreadSpecificData structure of this thread to the list
         * of ThreadSpecificData structures of all threads that are waiting
         * on file events.
         */


        tsdPtr->nextPtr = waitingListPtr;
        if (waitingListPtr) {
            waitingListPtr->prevPtr = tsdPtr;
        }
        tsdPtr->prevPtr = 0;
        waitingListPtr = tsdPtr;
	tsdPtr->onList = 1;
	
	Tcl_MutexUnlock(&notifierMutex);
	write(triggerPipe, "", 1);
	Tcl_MutexLock(&notifierMutex);
    }

    memset((VOID *) tsdPtr->readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask));

    if (!tsdPtr->eventReady) {

        Tcl_ConditionWait(&tsdPtr->waitCV, &notifierMutex, timePtr);
    }
    tsdPtr->eventReady = 0;

    if (waitForFiles && tsdPtr->onList) {
	/*
	 * Remove the ThreadSpecificData structure of this thread from the
................................................................................
            waitingListPtr = tsdPtr->nextPtr;
        }
        if (tsdPtr->nextPtr) {
            tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
        }
        tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
	tsdPtr->onList = 0;
        Tcl_MutexUnlock(&notifierMutex);
	write(triggerPipe, "", 1);
        Tcl_MutexLock(&notifierMutex);

    }

    
#else
    memcpy((VOID *) tsdPtr->readyMasks, (VOID *) tsdPtr->checkMasks,
	    3*MASK_SIZE*sizeof(fd_mask));
    numFound = select(tsdPtr->numFdBits,