Ticket UUID: | 406058 | |||
Title: | Bug in thread library | |||
Type: | Bug | Version: | None | |
Submitter: | villalba | Created on: | 2001-03-05 17:21:49 | |
Subsystem: | 80. Thread Package | Assigned To: | davygrvy | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2001-05-27 10:22:40 | |
Resolution: | Duplicate | Closed By: | davygrvy | |
Closed on: | 2001-05-27 03:22:40 | |||
Description: |
working with Thread-2.1 under Windows-NT I found the following bug. While executing for {set i 0} {$i < 1000} {incr i} { set T [thread::create] catch "thread::send $T thread::exit" } you can see in Task manager (of windows) that the number of handles* grows up. * under processes in task manager choose columns in View menu and mark number of handles. Greetings, Villalba | |||
User Comments: |
davygrvy added on 2001-05-12 06:28:51:
Logged In: YES user_id=7549 I should have said, "never caused the app's handle count to increment at all." davygrvy added on 2001-05-12 05:40:54: Logged In: YES user_id=7549 All I can say is that it worked for me and dropping the handle reference in Tcl_CreateThread did cause the app's handle count to decrement when the thread closed. If you have any other ideas for a fix, let me know. villalba added on 2001-05-11 21:22:04: Logged In: YES user_id=166340 I´ve tried the patch http://sourceforge.net/tracker/? func=detail&atid=110894&aid=419683&group_id=10894 but it isn´t successful. davygrvy added on 2001-05-11 05:22:05: Logged In: YES user_id=7549 Under deeper inspection of your code, I'd like to edit it for better cross-platform support of the threading macros in tcl.h. Honestly, casting of function types is evil. Especially the calling convention part. I don't think I'm being nit-picky because the compiler will emit different different machine code for __cdecl and __stdcall. Try it and look at the difference of the stack handling of the listing .asm file. There's no handle leak present with the patch from 419683 applied. nobody added on 2001-05-11 05:18:42: File Added - 6187: test1.c davygrvy added on 2001-05-11 02:11:31: Logged In: YES user_id=7549 See http://sourceforge.net/tracker/? func=detail&atid=110894&aid=419683&group_id=10894 for the patch that fixes your problem as was stated before. villalba added on 2001-05-10 20:50:11: Logged In: YES user_id=166340 It isn´t a problem of the thread library, but Tcl core. Pay attention to the following easy example. #include <tcl.h> int ThreadMainProc( int& I ) { I = 0; return 0; } int main( void ) { int I = 1; Tcl_ThreadId* ThreadId = NULL; // At this point the number of handles is 14 and of threads 1. if( Tcl_CreateThread( ThreadId, (unsigned int (__stdcall *)(void *)) ThreadMainProc, &I, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS ) != TCL_OK) { return 1;// Error handle } // This loop is finished by the thread. // At this point the number of handles is 15 and of threads 2. while( I ) printf( "%d", I ); // At this point the number of handles is 15 and of threads 1, i.e. the thread is dead. return 0; } davygrvy added on 2001-04-28 10:01:38: Logged In: YES user_id=7549 See https://sourceforge.net/tracker/index.php? func=detail&aid=419683&group_id=10894&atid=110894 for the proposed fix. dgp added on 2001-04-26 05:03:08: Logged In: YES user_id=80530 Changed category as requested. davygrvy added on 2001-04-26 04:36:58: Logged In: YES user_id=7549 change the catagory to the thread package, please. see https://sourceforge.net/tracker/index.php? func=detail&aid=418689&group_id=10894&atid=110894 for a possible solution. |
Attachments:
- test1.c [download] added by nobody on 2001-05-11 05:18:42. [details]