summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/notify.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/notify.c b/src/notify.c
index 886a7e6..7475611 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -55,6 +55,7 @@ static struct notify_vars notify;
static struct notify_app notify_app;
static pthread_attr_t detached_thread_attr;
static pthread_t notify_t_main;
+static int notify_t_main_running;
/*
* Return the number of seconds before next appointment
@@ -193,10 +194,12 @@ void notify_free_app(void)
/* Stop the notify-bar main thread. */
void notify_stop_main_thread(void)
{
- if (notify_t_main) {
- pthread_cancel(notify_t_main);
- pthread_join(notify_t_main, NULL);
- }
+ if (!notify_t_main_running)
+ return;
+
+ pthread_cancel(notify_t_main);
+ pthread_join(notify_t_main, NULL);
+ notify_t_main_running = 0;
}
/*
@@ -552,10 +555,12 @@ int notify_same_recur_item(struct recur_apoint *i)
/* Launch the notify-bar main thread. */
void notify_start_main_thread(void)
{
- /* Avoid starting the notification bar thread twice. */
- notify_stop_main_thread();
+ if (notify_t_main_running)
+ return;
pthread_create(&notify_t_main, NULL, notify_main_thread, NULL);
+ notify_t_main_running = 1;
+
notify_check_next_app(0);
}