100 % CPU usage with wxSocket

Lukasz Michalski lm at zork.pl
Thu Dec 20 07:33:01 PST 2007


On Thursday 20 December 2007, Kip Warner wrote:
> Greetings,
>
> When I am done with the socket in each client socket thread, I call
> ClientSocket->Destroy() in the thread deconstructor. The thread exits

Your problem is caused by ScheduleForDestroy() call from child thread which 
modifies global list that is not thread safe.

I would rather call ClientSocket->Close() and delete pointer to socket in 
thread that owns it. If you don't use events then there is no need for 
Destroy(). Destroy() can be used safely only in main thread.

Regards,
-- 
Lukasz Michalski
pgp key: http://www.zork.pl/lm.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.wxwidgets.org/pipermail/wx-users/attachments/20071220/a6a17573/attachment.pgp


More information about the wx-users mailing list