Overview
| Artifact ID: | 6c88d21ccbaec962048eaf7e70619efcab33eefc |
|---|---|
| Ticket: | d3071887dbc7aeac5f5f71741239720e9f72584c
Fix SEGV in Tcl_FinalizeNotifier() |
| User & Date: | anonymous on 2016-03-20 12:13:48 |
Changes
- icomment:
Then another (better) candidate is the following, instead to remove notiferInitMutex protection. pthread_mutex_lock(¬ifierInitMutex); pthread_mutex_lock(¬ifierMutex); pthread_cond_wait(¬ifierCV, ¬ifierMutex); pthread_mutex_unlock(¬ifierMutex); pthread_mutex_unlock(¬ifierInitMutex); Because notifierCV is protected by notifierMutex in other places (StartNotifierThread and NotifierThreadProc). So without notifierMutex lock, it would be wrong way (has possibility of race). And notiferInitMutex protects "notifierCount", etc. I tested the following, and it seems to be working. --- debian/changelog | 6 ++++++ unix/tclUnixNotfy.c | 2 ++ 2 files changed, 8 insertions(+) diff -puN unix/tclUnixNotfy.c~fix-mutex-typo unix/tclUnixNotfy.c --- tcl8.6-8.6.5+dfsg/unix/tclUnixNotfy.c~fix-mutex-typo 2016-03-19 01:56:33.736475677 +0900 +++ tcl8.6-8.6.5+dfsg-hirofumi/unix/tclUnixNotfy.c 2016-03-20 20:42:03.421497517 +0900 @@ -433,9 +433,11 @@ Tcl_FinalizeNotifier( "unable to write q to triggerPipe"); } close(triggerPipe); + pthread_mutex_lock(¬ifierMutex); while(triggerPipe != -1) { pthread_cond_wait(¬ifierCV, ¬ifierMutex); } + pthread_mutex_unlock(¬ifierMutex); if (notifierThreadRunning) { int result = pthread_join((pthread_t) notifierThread, NULL); - login: "anonymous"
- mimetype: "text/plain"
- username: "[email protected]"