Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #513: allow stop when not started #514

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/listen/event/loop.rb
Expand Up @@ -67,7 +67,7 @@ def stop
return if stopped?
transition! :stopped

if @wait_thread.alive?
if @wait_thread&.alive?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feeback from @ioquatix

I think you can just do @wait_thread.join
the if statement, is a race condition

True! And building on that, the return if stopped? is a race condition too. I'm getting rid of both, in favor of simply @wait_thread&.join.

@wait_thread.join
end
@wait_thread = nil
Expand Down