mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-11 08:48:06 +01:00
move to using rwlock
This commit is contained in:
parent
12fc28315c
commit
7036e53229
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue