diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:45 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:45 +0200 |
| commit | 23c5e7d57e1e9216f4da3446656df2dc7202975d (patch) | |
| tree | b387afc4ad6acad4681252df8ce8def5dc8aa54d /sock.h | |
| parent | 9dcec1feba68dc5ba38cdc634f5bf113c0f77348 (diff) | |
tagging ychat-0.1ychat-0.1
Diffstat (limited to 'sock.h')
| -rw-r--r--[-rwxr-xr-x] | sock.h | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -1,7 +1,7 @@ // class sock declaration. -#ifndef s_sock_H -#define s_sock_H +#ifndef SOCK_H +#define SOCK_H #include <queue> #include <arpa/inet.h> @@ -15,10 +15,8 @@ #include <unistd.h> #include "incl.h" -#include "pool.h" #include "reqp.h" #include "thrd.h" -#include "user.h" using namespace std; @@ -27,14 +25,24 @@ class sock private: // total number of server requests. unsigned long long int i_req; + queue<pthread_t> thrd_pool; + + int i_thrd_pool_size; bool b_run; // true while socket manager is running. reqp* req_parser; // parses the http requests from clients. - pool* thrd_pool; // the thread pool. - // creates a server socket. + // the chat stream there all the chat messages will sent through. +#ifdef THRDMOD + static void chat_stream( int i_sock, map_string &map_params ); +#else + static void chat_stream( int i_sock, map_string &map_params, queue<pthread_t> &thrd_pool ); +#endif virtual int make_socket( uint16_t port ); + static void *posix_thread_func ( void *v_pointer ); + static void *posix_thread_func_( void *v_pointer ); + public: // small inline methods: bool get_run() const { return b_run; } @@ -42,12 +50,10 @@ public: // public methods. explicit sock( ); // simple constructor. - virtual int read_write( thrd* p_thrd, int filedes ); + virtual int read_write( int filedes ); virtual int start(); - // the chat stream there all the chat messages will sent through. - static void chat_stream( int i_sock, user* p_user, map_string &map_params ); - + virtual void refill_thrd_pool( ); // refills the thread pool with new thewads. }; #endif |
