Reputation: 695
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?
Upvotes: 2
Views: 457
Reputation: 10396
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.
Upvotes: 3