aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-base.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-19 21:23:20 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-19 21:23:20 +0200
commit6d14945e40a63086702ee4d0698032c3708337ed (patch)
tree0dd80b5aae8ca85ad18b44ef763288a666b75e2c /src/mds-base.c
parentset up signal handling (diff)
downloadmds-6d14945e40a63086702ee4d0698032c3708337ed.tar.gz
mds-6d14945e40a63086702ee4d0698032c3708337ed.tar.bz2
mds-6d14945e40a63086702ee4d0698032c3708337ed.tar.xz
m + store master thread
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-base.c')
-rw-r--r--src/mds-base.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mds-base.c b/src/mds-base.c
index ec92571..782f526 100644
--- a/src/mds-base.c
+++ b/src/mds-base.c
@@ -30,17 +30,19 @@
#include <sys/un.h>
#include <unistd.h>
#include <signal.h>
+#include <pthread.h>
#define try(INSTRUCTION) if ((r = INSTRUCTION)) return r
-int argc;
-char** argv;
+int argc = 0;
+char** argv = NULL;
int is_respawn = 0;
int is_reexec = 0;
int socket_fd = -1;
+pthread_t master_thread;
@@ -143,9 +145,13 @@ int main(int argc_, char** argv_)
try (parse_cmdline());
- /* Set up signal traps for all especially handled signals. */
+ /* Store the current thread so it can be killed from elsewhere. */
+ master_thread = pthread_self();
+
+ /* Set up signal traps for all especially handled signals. */
trap_signals();
+
/* Connect to the display. */
if (is_reexec == 0)
try (connect_to_display());