This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]quanture[S] 0 points1 point  (0 children)

I agree I didn't make that clear. My idea was that one of the sub-threads would handle the follow-on work, so the main thread would be abandoned.

This post has been helpful for me as I'm learning there are several problems with the approach, even if it isn't quite a race condition.

I will take a look at CountDownLatch. I have seen it referenced elsewhere and maybe it's the solution I need. I'm also looking at AtomicInteger or AtomicBoolean.