AW: [AGENT++] Thread handle leak (SNMP++ 3.2.21a)

Eggers, Henning Henning.Eggers at plath.de
Wed Jan 17 08:38:41 CET 2007


But isn't this the same thing I reported in "Threading Problem"? The solution my colleague suggested wasn't that simple because his experience (which is more than mine when it comes to Win32 programming) showed that waiting on the Thread handle isn't safe.

As his fixes didn't make it to the list, I will mail them to Jochen directly.

Cheers,
Henning

> -----Ursprüngliche Nachricht-----
> Von: agentpp-bounces at agentpp.org 
> [mailto:agentpp-bounces at agentpp.org] Im Auftrag von Jochen Katz
> Gesendet: Dienstag, 16. Januar 2007 23:32
> An: agentpp at agentpp.org
> Betreff: Re: [AGENT++] Thread handle leak (SNMP++ 3.2.21a)
> Wichtigkeit: Hoch
> 
> Hi,
> 
> > SNMP++ seems to cause handle leakage under Win32 because the thread
> > handle m_hThread that is assigned inside 
> Snmp::start_poll_thread() is
> > not closed via a call to CloseHandle() in Snmp::stop_poll_thread().
> > 
> > Could you, please, confirm this one and eventually give some info
> > when it could get patched?
> 
> it can be patched immediately ;-)
> 
> Just change stop_poll_thread() to;
> #ifdef WIN32
>     ::WaitForSingleObject(m_hThread, INFINITE);
>     CloseHandle(m_hThread);
> #elif defined (CPU) && CPU == PPC603
> 
> This will be in the next release.
> 
> A funny thing: If you don't need the handle after the thread 
> is started,
> you can write code like this:
> CloseHandle(CreateThread(NULL,0, ThreadA,NULL,0,NULL));
> 
> 
> Regards,
>   Jochen
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp
> 
> 




More information about the AGENTPP mailing list