move to using rwlock

This commit is contained in:
ehouse 2005-04-20 12:03:58 +00:00
parent 12fc28315c
commit 7036e53229

View file

@ -42,12 +42,17 @@ class XWThreadPool {
void Setup( int nThreads, packet_func pFunc ); void Setup( int nThreads, packet_func pFunc );
/* Add to set being listened on */
void AddSocket( int socket ); void AddSocket( int socket );
void RemoveSocket( int socket ); /* remove from tpool altogether, and close */
void CloseSocket( int socket );
void Poll(); void Poll();
private: private:
/* Remove from set being listened on */
int RemoveSocket( int socket );
void enqueue( int socket ); void enqueue( int socket );
int get_process_packet( int socket ); int get_process_packet( int socket );
void interrupt_poll(); void interrupt_poll();
@ -60,7 +65,7 @@ class XWThreadPool {
/* Sockets main thread listens on */ /* Sockets main thread listens on */
vector<int> m_activeSockets; vector<int> m_activeSockets;
pthread_mutex_t m_activeSocketsMutex; pthread_rwlock_t m_activeSocketsRWLock;
/* Sockets waiting for a thread to read 'em */ /* Sockets waiting for a thread to read 'em */
deque<int> m_queue; deque<int> m_queue;