Ticket #513 (closed bug: fixed)
possible race condition wrt PingThread
| Reported by: | Tobi | Owned by: | BrainDamage |
|---|---|---|---|
| Priority: | major | Milestone: | 0.1 basic functionality |
| Component: | code quality | Version: | windows |
| Keywords: | threading ping | Cc: |
Description
I was trying to get SL working somewhat more stable with VC 9, and stumbled upon a possible cause for a race condition:
The issue is that in Socket::Disconnect() _EnablePingThread( false ) is called INSIDE the LOCK_SOCKET block.
However, if you're unlucky, the ping thread may be just after evaluation of the following condition in the if statement, but just before calling Send().
void Socket::Ping()
{
// wxLogMessage( _T("Sent ping.") );
if ( m_ping_msg != wxEmptyString ) Send( m_ping_msg );
}
If this is the case then Send() will try to enter the socket critical section too (LOCK_SOCKET there too), while it was already locked by the main thread that's now waiting for the ping thread to finish.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
