00001 #ifndef _MYTH_SOCKET_THREAD_H_ 00002 #define _MYTH_SOCKET_THREAD_H_ 00003 00004 #include <QWaitCondition> 00005 #include <QMutex> 00006 #include <QList> 00007 00008 #include "mythbaseexp.h" 00009 #include "mthread.h" 00010 00011 MBASE_PUBLIC void ShutdownRRT(void); 00012 00013 class MythSocket; 00014 class MythSocketThread : public MThread 00015 { 00016 public: 00017 MythSocketThread(); 00018 00019 virtual void run(void); 00020 00021 void StartReadyReadThread(void); 00022 void WakeReadyReadThread(void) const; 00023 void ShutdownReadyReadThread(void); 00024 00025 void AddToReadyRead(MythSocket *sock); 00026 void RemoveFromReadyRead(MythSocket *sock); 00027 00028 private: 00029 void ProcessAddRemoveQueues(void); 00030 void ReadyToBeRead(MythSocket *sock); 00031 void CloseReadyReadPipe(void) const; 00032 00033 bool m_readyread_run; 00034 mutable QMutex m_readyread_lock; 00035 mutable QWaitCondition m_readyread_wait; 00036 mutable QWaitCondition m_readyread_started_wait; 00037 00038 mutable int m_readyread_pipe[2]; 00039 mutable long m_readyread_pipe_flags[2]; 00040 00041 QList<MythSocket*> m_readyread_list; 00042 QList<MythSocket*> m_readyread_dellist; 00043 QList<MythSocket*> m_readyread_addlist; 00044 QList<MythSocket*> m_readyread_downref_list; 00045 00046 static const uint kShortWait; 00047 }; 00048 00049 #endif // _MYTH_SOCKET_THREAD_H_
1.6.3