--- innwebd/outd.cpp 2004/07/04 06:45:23 1.4 +++ innwebd/outd.cpp 2008/04/11 17:14:49 1.9 @@ -1,14 +1,10 @@ /*******************************************************/ /* */ /* LeafOK Innbbsd */ -/* Copyright (C) LeafOK.com, 2003-2004 */ /* */ -/* Programmed by Leaf */ -/* E-mail:leaflet@leafok.com QQ:6049044 */ +/* Copyright (C) LeafOK.com, 2003-2008 */ /* */ -/* http://bbs.leafok.com */ -/* http://bbs.leafok.net */ -/* http://bbs.fenglin.info */ +/* http://www.leafok.com */ /* */ /*******************************************************/ @@ -53,7 +49,8 @@ int outd::work() if (hThreadCurrent = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)base_active::SendThread,(LPVOID)p,0,&ulThreadId)) { base_active::uThreadCount++; - syslog << logfile::log_head << "Create send thread ... OK" << endl; + CloseHandle(hThreadCurrent); +// syslog << logfile::log_head << "Create send thread ... OK" << endl; } else { @@ -68,13 +65,21 @@ int outd::work() //Terminate if timeout(5 minutes) or stopped if ((t_count >= 3000 || this->thread_terminate) && base_active::uThreadCount > 0) { - if (TerminateThread(hThreadCurrent,-1)) + if ((hThreadCurrent = OpenThread(THREAD_TERMINATE,FALSE,ulThreadId)) == NULL) { - syslog << logfile::log_head << "Terminate send thread ... OK" << endl; + syslog << logfile::log_head << "Get thread handle error in outd::work()" << endl; } else { - syslog << logfile::log_head << "Terminate send thread ... Failed" << endl; + if (TerminateThread(hThreadCurrent,-1)) + { + syslog << logfile::log_head << "Terminate send thread ... OK" << endl; + } + else + { + syslog << logfile::log_head << "Terminate send thread ... Failed" << endl; + } + CloseHandle(hThreadCurrent); } base_active::uThreadCount--; }