Skip to content

a little question about stop a thread #2

Description

@zachbai2016

As we konw, you use two parameraters 'shouldStop' and 'isStopped' to determine whether a thread is stopped or is stopping.

you have not use thread.stop() method to stop the thread itself straightly, but let the thread go die naturally.

while a thread need to stop, we set shouldStop = true;

and the executing thread is continue do what it shoud do, when id do this work and next loop is coming, the shouldStop's value is true, the thread set stopped = true; and end/exit the run() method and make the thread to DEAD STATE naturally,

am i right in this logic ?

looking forwward your reply ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions