Fix removing the config and sending a SIGUSR1 results in segfault
[monky] / src / timed_thread.h
index 13cd880..cc4adcd 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id$ */
-
-/* timed_thread.h: Abstraction layer for timed threads
+/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
+ *
+ * timed_thread.h: Abstraction layer for timed threads
  *
  * Copyright (C) 2006-2007 Philip Kovacs pkovacs@users.sourceforge.net
  *
@@ -22,6 +22,8 @@
 #ifndef _TIMED_THREAD_H_
 #define _TIMED_THREAD_H_
 
+#include <stdlib.h>
+
 /* 10000 microseconds = 10 ms =  0.01 sec */
 #define MINIMUM_INTERVAL_USECS 10000
 
@@ -45,13 +47,13 @@ int timed_thread_lock(timed_thread *p_timed_thread);
 /* unlock a timed thread after critical section activity */
 int timed_thread_unlock(timed_thread *p_timed_thread);
 
-/* waits required interval for termination signal
- * returns 1 if received,
- * 0 otherwise */
-int timed_thread_test(timed_thread *p_timed_thread);
+/* waits required interval (unless override_wait_time is non-zero) for
+ * termination signal returns 1 if received, 0 otherwise.  should also return 1
+ * if the thread has been asked kindly to die.  */
+int timed_thread_test(timed_thread *p_timed_thread, int override_wait_time);
 
 /* exit a timed thread */
-void timed_thread_exit(timed_thread *p_timed_thread);
+void timed_thread_exit(timed_thread *p_timed_thread) __attribute__((noreturn));
 
 /* register a timed thread for future destruction via
  * timed_thread_destroy_registered_threads() */
@@ -61,4 +63,7 @@ int timed_thread_register(timed_thread *p_timed_thread,
 /* destroy all registered timed threads */
 void timed_thread_destroy_registered_threads(void);
 
+/* returns read file descriptor for thread pipe */
+int timed_thread_readfd(timed_thread *p_timed_thread);
+
 #endif /* #ifdef _TIMED_THREAD_H_ */