[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] player: explicitly stop+wait for sink death at_exit
From: |
Eric Wong |
Subject: |
[PATCH 4/4] player: explicitly stop+wait for sink death at_exit |
Date: |
Sun, 1 Sep 2013 22:16:51 +0000 |
This allows me to hit Ctrl-C on a dtas-player(1) process, wait on
termination of the player, and immediately restart it without
worrying about sink conflicts upon restart.
Before this change, sinks would continue running for a bit
(depending on buffer sizes).
---
bin/dtas-player | 5 ++++-
lib/dtas/player.rb | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/bin/dtas-player b/bin/dtas-player
index 640d31c..401a500 100755
--- a/bin/dtas-player
+++ b/bin/dtas-player
@@ -26,7 +26,10 @@ else
player.socket = sock
end
-at_exit { player.close }
+at_exit do
+ player.close
+ Process.waitall
+end
player.bind
trap(:INT) { exit }
trap(:TERM) { exit }
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index 3571a7f..2bf2716 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -419,6 +419,7 @@ class DTAS::Player # :nodoc:
end while true
ensure
__current_requeue
+ stop_sinks
trap(:CHLD, old_chld)
sev.close if sev
# for state file
--
1.8.4