diff -r 4a28de5b9b47 -r 879bd09e2b96 thermferm/thermferm.c --- a/thermferm/thermferm.c Mon Jun 23 22:50:29 2014 +0200 +++ b/thermferm/thermferm.c Tue Jun 24 20:21:07 2014 +0200 @@ -40,7 +40,9 @@ extern unsigned char lcdbuf[MAX_LCDS][20][4]; #endif int lcdupdate; - +#ifndef HAVE_WIRINGPI_H +pthread_t threads[2]; +#endif int server(void); void help(void); @@ -227,10 +229,10 @@ char buf[1024]; time_t now, last = (time_t)0; w1_therm *tmp1; -#ifdef HAVE_WIRINGPI_H - int rc; + int rc, run = 1, temp; +#ifndef HAVE_WIRINGPI_H + long t = 0; #endif - int run = 1, temp; if (lockprog((char *)"thermferm")) { syslog(LOG_NOTICE, "Can't lock"); @@ -239,17 +241,23 @@ #ifdef HAVE_WIRINGPI_H rc = piThreadCreate(my_sensors_loop); +#else + rc = pthread_create(&threads[0], NULL, my_sensors_loop, (void *)t ); +#endif if (rc) { fprintf(stderr, "my_sensors_loop thread didn't start rc=%d\n", rc); syslog(LOG_NOTICE, "my_sensors_loop thread didn't start rc=%d", rc); } +#ifdef HAVE_WIRINGPI_H rc = piThreadCreate(my_server_loop); +#else + rc = pthread_create(&threads[1], NULL, my_server_loop, (void *)t ); +#endif if (rc) { fprintf(stderr, "my_server_loop thread didn't start rc=%d\n", rc); syslog(LOG_NOTICE, "my_server_loop thread didn't start rc=%d", rc); } -#endif snprintf(buf, 1023, "tempA,tempB"); logger((char *)"thermferm.log", (char *)"thermferm", buf);