From 6d14945e40a63086702ee4d0698032c3708337ed Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 19 May 2014 21:23:20 +0200 Subject: m + store master thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-base.c | 12 +++++++++--- src/mds-base.h | 8 ++++++++ 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 #include #include +#include #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 + + /** * 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; + /** -- cgit v1.2.3-70-g09d2