diff options
Diffstat (limited to 'include/server.h')
-rw-r--r-- | include/server.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/server.h b/include/server.h index e59c38d..238946a 100644 --- a/include/server.h +++ b/include/server.h @@ -1,6 +1,38 @@ #ifndef _SERVER_H_ #define _SERVER_H_ +#include <stdlib.h> +#include <pthread.h> +#include <netinet/in.h> +#include "http.h" +#define THREAD_POOL_NUM 12 +#define MAX_FD_QUEUE 512 + +struct fd_queue { + int queue[512]; + ssize_t front; + ssize_t back; + size_t count; +}; + +struct thread_data { + struct fd_queue queue; + pthread_mutex_t lock; + pthread_cond_t cond; + struct http *http; +}; + +struct server { + int server_fd; + struct sockaddr_in addr; + int addrlen; + pthread_t *pool; + size_t thread_pool_size; + struct thread_data data; +}; + +struct server *server_init(struct http *http); +void server_poll(struct server *server); #endif |