Sat, 09 Aug 2014 17:24:32 +0200
Added panel thread
thermferm/panel.c | file | annotate | diff | comparison | revisions | |
thermferm/panel.h | file | annotate | diff | comparison | revisions | |
thermferm/thermferm.c | file | annotate | diff | comparison | revisions |
--- 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
--- 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
--- 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 */