| 1 |
/*******************************************************/ |
/*******************************************************/ |
| 2 |
/* */ |
/* */ |
| 3 |
/* LeafOK Innbbsd */ |
/* LeafOK Innbbsd */ |
|
/* Copyright (C) LeafOK.com, 2003-2004 */ |
|
| 4 |
/* */ |
/* */ |
| 5 |
/* Programmed by Leaf */ |
/* Copyright (C) LeafOK.com, 2003-2008 */ |
|
/* E-mail:leaflet@leafok.com QQ:6049044 */ |
|
| 6 |
/* */ |
/* */ |
| 7 |
/* http://bbs.leafok.com */ |
/* http://www.leafok.com */ |
|
/* http://bbs.leafok.net */ |
|
|
/* http://bbs.fenglin.info */ |
|
| 8 |
/* */ |
/* */ |
| 9 |
/*******************************************************/ |
/*******************************************************/ |
| 10 |
|
|
| 49 |
if (hThreadCurrent = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)base_active::SendThread,(LPVOID)p,0,&ulThreadId)) |
if (hThreadCurrent = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)base_active::SendThread,(LPVOID)p,0,&ulThreadId)) |
| 50 |
{ |
{ |
| 51 |
base_active::uThreadCount++; |
base_active::uThreadCount++; |
| 52 |
syslog << logfile::log_head << "Create send thread ... OK" << endl; |
CloseHandle(hThreadCurrent); |
| 53 |
|
// syslog << logfile::log_head << "Create send thread ... OK" << endl; |
| 54 |
} |
} |
| 55 |
else |
else |
| 56 |
{ |
{ |
| 65 |
//Terminate if timeout(5 minutes) or stopped |
//Terminate if timeout(5 minutes) or stopped |
| 66 |
if ((t_count >= 3000 || this->thread_terminate) && base_active::uThreadCount > 0) |
if ((t_count >= 3000 || this->thread_terminate) && base_active::uThreadCount > 0) |
| 67 |
{ |
{ |
| 68 |
if (TerminateThread(hThreadCurrent,-1)) |
if ((hThreadCurrent = OpenThread(THREAD_TERMINATE,FALSE,ulThreadId)) == NULL) |
| 69 |
{ |
{ |
| 70 |
syslog << logfile::log_head << "Terminate send thread ... OK" << endl; |
syslog << logfile::log_head << "Get thread handle error in outd::work()" << endl; |
| 71 |
} |
} |
| 72 |
else |
else |
| 73 |
{ |
{ |
| 74 |
syslog << logfile::log_head << "Terminate send thread ... Failed" << endl; |
if (TerminateThread(hThreadCurrent,-1)) |
| 75 |
|
{ |
| 76 |
|
syslog << logfile::log_head << "Terminate send thread ... OK" << endl; |
| 77 |
|
} |
| 78 |
|
else |
| 79 |
|
{ |
| 80 |
|
syslog << logfile::log_head << "Terminate send thread ... Failed" << endl; |
| 81 |
|
} |
| 82 |
|
CloseHandle(hThreadCurrent); |
| 83 |
} |
} |
| 84 |
base_active::uThreadCount--; |
base_active::uThreadCount--; |
| 85 |
} |
} |