aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mds-base.c12
-rw-r--r--src/mds-base.h8
2 files changed, 17 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());
diff --git a/src/mds-base.h b/src/mds-base.h
index e206a78..b4e4ad7 100644
--- a/src/mds-base.h
+++ b/src/mds-base.h
@@ -19,6 +19,9 @@
#define MDS_MDS_BASE_H
+#include <pthread.h>
+
+
/**
* Characteristics of the server
*/
@@ -71,6 +74,11 @@ extern int is_reexec;
*/
extern int socket_fd;
+/**
+ * The thread that runs the master loop
+ */
+extern pthread_t master_thread;
+
/**