Socket::SocketThread Class ReferenceDetached socket run thread.
More...
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| SocketThread (Socket *p) | |
| ~SocketThread () | |
| void | Run () |
Private Member Functions | |
| Socket * | GetSocket () const |
| SocketThread (const SocketThread &s) | |
| SocketThread & | operator= (const SocketThread &) |
Private Attributes | |
| Socket * | m_socket |
Definition at line 66 of file Socket.h.
| Socket::SocketThread::SocketThread | ( | Socket * | p | ) |
| Socket::SocketThread::~SocketThread | ( | ) |
Definition at line 894 of file Socket.cpp.
References Thread::IsRunning(), Thread::SetRelease(), and Thread::SetRunning().
00895 { 00896 if (IsRunning()) 00897 { 00898 SetRelease(true); 00899 SetRunning(false); 00900 #ifdef _WIN32 00901 Sleep(1000); 00902 #else 00903 sleep(1); 00904 #endif 00905 } 00906 }
| Socket::SocketThread::SocketThread | ( | const SocketThread & | s | ) | [inline, private] |
| void Socket::SocketThread::Run | ( | ) | [virtual] |
Implements Thread.
Definition at line 909 of file Socket.cpp.
References SocketHandler::Add(), SocketHandler::GetCount(), Thread::IsRunning(), m_socket, Socket::OnDetached(), SocketHandler::Select(), Thread::SetDeleteOnExit(), SocketHandler::SetSlave(), and Socket::SetSlaveHandler().
00910 { 00911 SocketHandler h; 00912 h.SetSlave(); 00913 h.Add(m_socket); 00914 m_socket -> SetSlaveHandler(&h); 00915 m_socket -> OnDetached(); 00916 while (h.GetCount() && IsRunning()) 00917 { 00918 h.Select(0, 500000); 00919 } 00920 // m_socket now deleted oops 00921 // yeah oops m_socket delete its socket thread, that means this 00922 // so Socket will no longer delete its socket thread, instead we do this: 00923 SetDeleteOnExit(); 00924 }
| Socket* Socket::SocketThread::GetSocket | ( | ) | const [inline, private] |
| SocketThread& Socket::SocketThread::operator= | ( | const SocketThread & | ) | [inline, private] |
Socket* Socket::SocketThread::m_socket [private] |
1.4.4