Skip to content

Commit

Permalink
Add a way to stop the Notifier#run loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Nov 29, 2009
1 parent b1d1926 commit 3c1e030
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/rb-inotify/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,15 @@ def watch(path, *flags, &callback)
#
# @see #process
def run
loop {process}
@stop = false
process until @stop || closed?
end

# Stop watching for filesystem events.
# That is, if we're in a \{#run} loop,
# exit out as soon as we finish handling the events.
def stop
@stop = true
end

# Blocks until there are one or more filesystem events
Expand Down

0 comments on commit 3c1e030

Please sign in to comment.