Good C ++ framework: Thrift

Source: Internet
Author: User

 

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.