I recently looked at the source code and found that Thrift class libraries and their framework classes are well implemented. They can accelerate development speed and program stability in other C ++ projects.
Concurrency related:
Thread Pool
Directly pre-allocate a specified Thread (in contrast to the dynamic state), and then add the asynchronous task to the thread pool.
Supports throttling (when too many pending tasks are added, they will be blocked)
Timeout is supported. tasks that have not been executed after the timeout time are cleared and passed as parameters to the corresponding callback handle.
Mutex
Monter encapsulates mutex and notification
Based on the Synchronized and Guard daemon classes. (Synchronized is a thin package for Guard, so there is no difference in use. I wonder if I will do some special processing in the future)
Read/write lock
Scheduled Task Management
Connection class
Connection class
Supports the connection class of the server group. When the current failure occurs, the system automatically attempts to reconnect randomly from the connection group to find only one suitable connection class.
Other libevent-based server classes and various transmission protocols (such as file, pile, http, and socket) and their interaction will be further supplemented after subsequent interpretations.
Note:
A large number of boost: shared_ptr is used in the Code. It is estimated that its programmers are transferred from other advanced languages, so that memory management is lost to the system.