| Ticket UUID: | 990500 | ||
| Title: | NotifierThreadProc missing TclpThreadExit at end | ||
| Type: | Bug | Created on: | 2004-07-13 21:44:38 |
| Submitter: | mistachkin | Assigned to: | andreas_kupries |
| Subsystem: | 49. Threading | Severity: | |
| Priority: | 7 High | Last modified: | 2004-07-17 00:38:48 |
| Status: | Closed | Closed by: | andreas_kupries |
| Resolution: | Fixed | Closed on: | 2004-07-16 17:38:48 |
| Version: | None | ||
| Description: | ||||
I believe the NotifierThreadProc function in "unix/tclUnixNotfy.c" should end with a call to TclpThreadExit, to allow the pthread library to clean up any internal resources associated with the notifier thread. The general principal here is that threads created with TclpThreadCreate must be exited using TclpThreadExit. | ||||
| User Comments: | ||||
andreas_kupries added on 2004-07-16 05:30:36:
Logged In: YES user_id=75003 Hm. The description of that function says: Once started, this routine never exits. It dies with the overall process. In other words, even if we add TclpThreadExit it will never be reached, right ? Hm, looking at the code instead I find that there is a way for the thread proc to exit, via a 'break' in its infinite loop. And that is done in response to reception of a 'quit message'. There is some other cleanup happening already ... I guess we can do the TclpThreadExit as well, as the very last action. Still, given Zoran's recent experience in this area (threads & notifier) I wait a bit on this will ask some other people to have a look at this as well. vasiljevic added on 2004-07-16 15:40:39:
Logged In: YES user_id=95086 I believe Joe is right. Every thread created by pthread_create should eventually call pthread_exit at the end of its life. Otherwise pthread library leaks. At this particular spot this is not very tragic for tclsh-like applications where main thread and the notifier thread exit just at the end of the app. But in systems loading and finalizing Tcl library as a subsystem, this may pose memory problems (leaks). My oppinion is: go ahead and add the TclpThreadExit at the end. andreas_kupries added on 2004-07-17 00:38:48:
Logged In: YES user_id=75003 Accepted and committed the change, to both head and 8.4 branch | ||||
