diff options
author | Joe Mistachkin <joe@mistachkin.com> | 2013-10-28 22:40:14 (GMT) |
---|---|---|
committer | Joe Mistachkin <joe@mistachkin.com> | 2013-10-28 22:40:14 (GMT) |
commit | 275aef21ecc230467a7849b792c43881b58557ff (patch) | |
tree | 8e75792744724552a8871405a3337826b2fe1760 /unix | |
parent | 6e55611be005b723e3f0d2ec521f2e73fce4c003 (diff) | |
download | tcl-tkt_414d10346b.zip tcl-tkt_414d10346b.tar.gz tcl-tkt_414d10346b.tar.bz2 |
Another attempt to cleanup stale remnants of the notifier subsystem.tkt_414d10346b
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixNotfy.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 2440b01..69ef7f2 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1320,6 +1320,8 @@ AtForkParentProc(void) static void AtForkChildProc(void) { + struct ThreadSpecificData *tsdPtr; + /* * Close the trigger pipe and reset it to the default value. This * should cause it to be re-opened when the notifier is subsequently @@ -1359,6 +1361,24 @@ AtForkChildProc(void) notifierCV = NULL; /* + * Free all the thread specific data for the notifier now. Since the + * child has no other threads, this data should be completely useless + * at this point. Unfortunately, there is currently no clean way to + * free the thread specific data structures themselves. + */ + + for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) { + FileHandler *filePtr; + for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL; + /* NO LOOP UPDATE */) { + FileHandler *nextFilePtr = filePtr->nextPtr; + ckfree((char *) filePtr); + filePtr = nextFilePtr; + } + } + waitingListPtr = NULL; + + /* * Release, finalize, and reset the notifier mutex (which has been * held since the AtForkPrepareProc() was called via pthread_atfork()). * This should force it to be re-created during the next call to @@ -1378,6 +1398,13 @@ AtForkChildProc(void) TclpResetLocks(); /* + * Next, abandon the thread specific data for this file. There is no + * clean way to free it; however, it can no longer be used. + */ + + dataKey = (Tcl_ThreadDataKey) 0; + + /* * Force the notifier subsystem to be initialized now. This should * create the notifier thread in this process. Subsequently, that new * thread will re-open the trigger pipe. |