How many times do you call 'c1.await()'
what count are your CyclicBarriers constructed
what about the size of your ThreadPool
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.
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.
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
global solutions you can do in your home or backyardhttps://coderanch.com/t/708587/global-solutions-home-backyard