# HG changeset patch # User Michiel Broek # Date 1407597872 -7200 # Node ID 3f5d277a69e3a419b7c529180720bd5f2bf1e299 # Parent 20716bcff2b0d165a5f6ee74c9496c3dcca538a8 Added panel thread diff -r 20716bcff2b0 -r 3f5d277a69e3 thermferm/panel.c --- a/thermferm/panel.c Sat Aug 09 17:06:25 2014 +0200 +++ b/thermferm/panel.c Sat Aug 09 17:24:32 2014 +0200 @@ -26,6 +26,37 @@ #ifdef HAVE_WIRINGPI_H +extern int my_shutdown; +extern int debug; + + + +PI_THREAD (my_panel_loop) +{ + + syslog(LOG_NOTICE, "Thread my_panel_loop started"); + if (debug) + fprintf(stdout, "Thread my_panel_loop started\n"); + + /* + * Loop forever until the external shutdown variable is set. + */ + for (;;) { + if (my_shutdown) + break; + + /* + * Loop 10 milliseconds + */ + usleep(10000); + } + + syslog(LOG_NOTICE, "Thread my_panel_loop stopped"); + if (debug) + fprintf(stdout, "Thread my_panel_loop stopped\n"); + + return 0; +} #endif diff -r 20716bcff2b0 -r 3f5d277a69e3 thermferm/panel.h --- a/thermferm/panel.h Sat Aug 09 17:06:25 2014 +0200 +++ b/thermferm/panel.h Sat Aug 09 17:24:32 2014 +0200 @@ -29,6 +29,9 @@ #define MENU_TIMEOUT 60 +PI_THREAD (my_panel_loop); + + #endif #endif diff -r 20716bcff2b0 -r 3f5d277a69e3 thermferm/thermferm.c --- a/thermferm/thermferm.c Sat Aug 09 17:06:25 2014 +0200 +++ b/thermferm/thermferm.c Sat Aug 09 17:24:32 2014 +0200 @@ -303,6 +303,14 @@ #endif } +#ifdef HAVE_WIRINGPI_H + rc = piThreadCreate(my_panel_loop); + if (rc) { + fprintf(stderr, "my_panel_loop thread didn't start rc=%d\n", rc); + syslog(LOG_NOTICE, "my_panel_loop thread didn't start rc=%d", rc); + } +#endif + /* * Initialize units for processing */