From cb611e38bef7b78051cf665d3167b98bb01cbefc Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 11 May 2020 22:18:00 +0200 Subject: [PATCH] Ensure the failsafe thread is a detached one Fix #17 --- src/failsafe.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/failsafe.c b/src/failsafe.c index 0f320c7..1105f42 100644 --- a/src/failsafe.c +++ b/src/failsafe.c @@ -64,8 +64,15 @@ void nm_failsafe_destroy(nm_failsafe_t *fs, int delay) { fs->delay = delay; NM_LOG("failsafe: scheduling restore"); + + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_t t; - pthread_create(&t, NULL, _nm_failsafe_destroy, fs); + pthread_create(&t, &attr, _nm_failsafe_destroy, fs); + const char name[16] = "nm_failsafe"; + pthread_setname_np(t, name); + pthread_attr_destroy(&attr); } void nm_failsafe_uninstall(nm_failsafe_t *fs) {