简体   繁体   中英

Can Boost asio post “overflow” the queue

In the event that there are too many operations to be handled and there are not enough resources (threads) to complete these operations, what happens then when you call .post?

Is there a way to drop all future operations based on the current queue size?

Yes and No.

No: The queue will grow indefinitely. It's like std::vector and co an infinite queue. There is no return value that tells you that the queue is full, neither there is blocking behavior.

Yes: The queue is only theoretically unlimited, at some point of time your machine is out of memory. At that point the the program might crash due to a bad allocation, or your OS will kill it due to extensive memory usage.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM