This project implements a server using Linux epoll and thread poll. The thread pool consists of a buffer and multithread mechanism. The buffer is a message queue, which applies producer-consumer model to process requests sent by clients. Mutex is used for multithread in order to avoid deadlock.
epoll provides a simple but high-efficient polling mechanism: (1) epoll_create1 creates a epoll instance; (2) epoll_ctl modifies the file descriptors in epoll instance; (3) epoll_wait is used to wait I/O events.
- when you want architecture to support multiple clients at the same time.
git clone https://github.com/henrytien/threadpool_epoll.git
If your system doesn't installed log4cpp, visit Log for C++ Project and you can download and install.
- building the server
cd threadpool_epoll
andsh start.sh
- building the client demo
cd client && make && sh client.sh
Here are class diagram and sequence diagram.