There are three kinds of actuaries: those who can count, and those who can't.
How many times do you call 'c1.await()'
what count are your CyclicBarriers constructed
what about the size of your ThreadPool
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
Stephan van Hulst wrote:Timeouts are not in general a correct way to deal with deadlocks . You must always try to make sure that there's a possibility for the application to get through blocking calls by itself. Timeouts are only intended to cancel blocking operations that you don't have control over, such as when waiting for user input or network communication, or a call to a plugin to return.
There are three kinds of actuaries: those who can count, and those who can't.
Tyoma Sakurakoji wrote:Your program design should be writen in such way to prevent it's possibility in the first place.
My last comment was about why coding so complex logic of fallback if CyclicBarrier is already have one leading to the same result - throwing exception on CyclibBarrier after some time and realeasing "stucked" threads.
Stephan van Hulst wrote:I missed that you likely responded in regards to Piet's code. My comments apply to so-called 'real code'. As Piet said, he is just experimenting.