summaryrefslogtreecommitdiff
path: root/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'sock.h')
-rw-r--r--[-rwxr-xr-x]sock.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/sock.h b/sock.h
index d477987..9893007 100755..100644
--- a/sock.h
+++ b/sock.h
@@ -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