Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add manual reporting of changes to the Darwin adapter

  • Loading branch information...
commit 38eec0301602badb714a0940f2380ac7348b60ba 1 parent b1e2607
Maher Sallam Maher4Ever authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/listen/adapters/darwin.rb
11 lib/listen/adapters/darwin.rb
View
@@ -25,13 +25,14 @@ def start(blocking = true)
end
@worker_thread = Thread.new { @worker.run }
- @poll_thread = Thread.new { poll_changed_dirs }
# The FSEvent worker needs sometime to startup. Turnstiles can't
# be used to wait for it as it runs in a loop.
# TODO: Find a better way to block until the worker starts.
- sleep @latency
- @poll_thread.join if blocking
+ sleep 0.1
+
+ @poll_thread = Thread.new { poll_changed_dirs } if @report_changes
+ @worker_thread.join if blocking
end
# Stops the adapter.
@@ -43,8 +44,8 @@ def stop
end
@worker.stop
- Thread.kill(@worker_thread) if @worker_thread
- @poll_thread.join
+ @worker_thread.join if @worker_thread
+ @poll_thread.join if @poll_thread
end
# Checks if the adapter is usable on the current OS.
Please sign in to comment.
Something went wrong with that request. Please try again.