summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tdutils.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/tdutils.c b/tdutils.c
index 0df00c3..693727f 100644
--- a/tdutils.c
+++ b/tdutils.c
@@ -44,7 +44,6 @@ static atomic_llong last_req_id = 0;
*/
bool closing = false;
-static bool sighandler_setup = false;
static pthread_t thread_sighandler;
/**
@@ -89,15 +88,11 @@ static void sighandler_init() {
if ((r = pthread_create(&thread_sighandler, NULL, &main_sighandler, NULL))) {
LOGFEV("pthread_create", r, strerror(r));
}
- sighandler_setup = true;
}
static int sighandler_close() {
- if (!sighandler_setup) return 0;
pthread_cancel(thread_sighandler);
- int r = pthread_join(thread_sighandler, NULL);
- if (!r) sighandler_setup = false;
- return r;
+ return pthread_join(thread_sighandler, NULL);
}
static int tdcb_push(long long request_id, void (*cb)(bool, struct TdObject *, struct TdError *, void *), void *cb_arg) {