From: <no...@so...> - 2001-05-11 23:24:46
|
Bugs item #406058, was updated on 2001-03-05 09:21 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=406058&group_id=10894 Category: Thread Package Group: None >Status: Open Resolution: Duplicate Priority: 5 Submitted By: Jesus Villalba (villalba) Assigned to: David Gravereaux (davygrvy) Summary: Bug in thread library Initial Comment: 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 ---------------------------------------------------------------------- Comment By: David Gravereaux (davygrvy) Date: 2001-05-11 15:40 Message: 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. ---------------------------------------------------------------------- Comment By: Jesus Villalba (villalba) Date: 2001-05-11 07:22 Message: 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. ---------------------------------------------------------------------- Comment By: David Gravereaux (davygrvy) Date: 2001-05-10 15:22 Message: 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. ---------------------------------------------------------------------- Comment By: David Gravereaux (davygrvy) Date: 2001-05-10 12:11 Message: 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. ---------------------------------------------------------------------- Comment By: Jesus Villalba (villalba) Date: 2001-05-10 06:50 Message: 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; } ---------------------------------------------------------------------- Comment By: David Gravereaux (davygrvy) Date: 2001-04-27 20:01 Message: 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. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2001-04-25 15:03 Message: Logged In: YES user_id=80530 Changed category as requested. ---------------------------------------------------------------------- Comment By: David Gravereaux (davygrvy) Date: 2001-04-25 14:36 Message: 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. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=406058&group_id=10894 |