[Pommed-commits] r362 - trunk/pommed

jblache at alioth.debian.org jblache at alioth.debian.org
Mon Oct 1 15:11:34 UTC 2007


Author: jblache
Date: 2007-10-01 15:11:34 +0000 (Mon, 01 Oct 2007)
New Revision: 362

Modified:
   trunk/pommed/beep.c
   trunk/pommed/pommed.c
Log:
Spawn the beep thread after daemonize.


Modified: trunk/pommed/beep.c
===================================================================
--- trunk/pommed/beep.c	2007-10-01 14:40:02 UTC (rev 361)
+++ trunk/pommed/beep.c	2007-10-01 15:11:34 UTC (rev 362)
@@ -57,6 +57,7 @@
 
 
 struct _beep_info beep_info;
+static int beep_thread_running = 0;
 
 
 /* Beep thread */
@@ -82,6 +83,7 @@
   beep_thread_command(AUDIO_CLICK);
 }
 
+
 int
 beep_open_device(void)
 {
@@ -89,6 +91,8 @@
   int fd;
   int ret;
 
+  beep_info.fd = -1;
+
   if (beep_cfg.enabled == 0)
     return -1;
 
@@ -190,13 +194,15 @@
       return -1;
     }
 
+  beep_thread_running = 1;
+
   return 0;
 }
 
 void
 beep_cleanup(void)
 {
-  if (beep_cfg.enabled == 0)
+  if (!beep_thread_running)
     return;
 
   beep_thread_command(AUDIO_COMMAND_QUIT);

Modified: trunk/pommed/pommed.c
===================================================================
--- trunk/pommed/pommed.c	2007-10-01 14:40:02 UTC (rev 361)
+++ trunk/pommed/pommed.c	2007-10-01 15:11:34 UTC (rev 362)
@@ -711,8 +711,6 @@
       exit(1);
     }
 
-  beep_init();
-
   nfds = evdev_open(&fds);
   if (nfds < 1)
     {
@@ -765,6 +763,9 @@
   fprintf(pidfile, "%d\n", getpid());
   fclose(pidfile);
 
+  /* Spawn the beep thread */
+  beep_init();
+
   gettimeofday(&tv_als, NULL);
 
   running = 1;




More information about the Pommed-commits mailing list