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

Stoyan Haralampiev tony at gyuvetch.bg
Wed Jan 17 14:24:19 CET 2007


Hi Henning,

Actually I had a look at your post right before I posted mine.

I saw that you had written about a problem that looked the same but in Agent's code rather than in SNMP++'s. I've never used Agent++ so I am not quite sure if it boils down to the same code or not.

Besides I saw that you suggest a way to reuse the thread handle rather than closing it.

That's why I posted my message.

Thanks for your comments and especially the one about waiting on a thread handle!

Best regards,
Tony


>-------- Оригинално писмо --------
>От: "Eggers, Henning"  
>Относно: AW: [AGENT++] Thread handle leak (SNMP++ 3.2.21a)
>До:  
>Изпратено на: Сряда, 2007, Януари 17 09:38:41 GMT+02:00
>----------------------------------
>
>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
>> 
>> 
>
>_______________________________________________
>AGENTPP mailing list
>AGENTPP at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/agentpp
> 

-----------------------------------------------------------------
Заложете на късмета си със Спортингбет!


More information about the AGENTPP mailing list