summaryrefslogtreecommitdiff
path: root/mteval/external_scorer.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2014-03-19 23:01:55 -0400
committerChris Dyer <cdyer@allegro.clab.cs.cmu.edu>2014-03-19 23:01:55 -0400
commit6d94c3484726c37d79d7e9b9e114121ca679487e (patch)
tree0a754c8b3c3d7970dc42946a579316c0606ea7d4 /mteval/external_scorer.cc
parenta1ff38d3427cf0892c3ea174da6939c8aea908bc (diff)
don't get blocked on zombies
Diffstat (limited to 'mteval/external_scorer.cc')
-rw-r--r--mteval/external_scorer.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/mteval/external_scorer.cc b/mteval/external_scorer.cc
index f1b3ed6e..c7c3de1a 100644
--- a/mteval/external_scorer.cc
+++ b/mteval/external_scorer.cc
@@ -4,6 +4,7 @@
#include <cstdlib>
#include <cstring>
#include <unistd.h>
+#include <signal.h>
#include <sstream>
#include <iostream>
#include <cassert>
@@ -15,6 +16,7 @@
using namespace std;
extern const char* meteor_jar_path;
+extern void metric_child_signal_handler(int);
map<string, boost::shared_ptr<ScoreServer> > ScoreServerManager::servers_;
@@ -46,6 +48,11 @@ ScoreServer* ScoreServerManager::Instance(const string& score_type) {
}
ScoreServer::ScoreServer(const string& cmd) {
+ static bool need_init = true;
+ if (need_init) {
+ need_init = false;
+ signal(SIGCHLD, metric_child_signal_handler);
+ }
cerr << "Invoking " << cmd << " ..." << endl;
if (pipe(p2c) < 0) { perror("pipe"); exit(1); }
if (pipe(c2p) < 0) { perror("pipe"); exit(1); }