Jul-17-2018, 12:33 AM
(This post was last modified: Jul-17-2018, 02:10 AM by svetlanarosemond.)
I posted this question on SO, but didn't receive an answer.
I came across these two pages (1,2) about cancelling threads.
Question:
Is using a
Is there any disadvantage to using the
From the docs:
I came across these two pages (1,2) about cancelling threads.
Question:
Is using a
boolean
to cancel a thread bad practice? Is the preferred method to use Event.set()
?Is there any disadvantage to using the
boolean
to cancel?From the docs:
Quote:Set the internal flag to true. All threads waiting for it to become true are awakened. Threads that call wait() once the flag is true will not block at all.