summaryrefslogtreecommitdiff
path: root/icmpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'icmpd.c')
-rw-r--r--icmpd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/icmpd.c b/icmpd.c
index d2afb88..6acb2da 100644
--- a/icmpd.c
+++ b/icmpd.c
@@ -43,11 +43,10 @@ struct icmpd {
};
// Global state
-bool thread_running = false;
-struct mt_mutex thread_mutex; // protecting these global values
-struct mt_thread thread;
-int thread_in, thread_out;
-int host_in, host_out;
+static bool thread_running = false;
+static struct mt_thread thread;
+static int thread_in, thread_out;
+static int host_in, host_out;
// Arguments to messages are listed in comments.
@@ -240,6 +239,8 @@ static void* thread_entry(void *arg) {
assert(found);
mt_mutex_destroy(&d->mut);
+ close(d->signal_out);
+ close(d->signal_in);
free(d);
break;
}
@@ -477,8 +478,6 @@ static void spawn_icmpd_thread(void) {
host_out = pp[1];
thread_in = pp[0];
- mt_mutex_init(&thread_mutex);
-
mt_thread_create(&thread, thread_entry, NULL);
struct msg_in msg = recv_message(host_in);