aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-base.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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());