229 |
228 |
230 int server(void) |
229 int server(void) |
231 { |
230 { |
232 char buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40]; |
231 char buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40]; |
233 time_t now, last = (time_t)0; |
232 time_t now, last = (time_t)0; |
234 w1_therm *tmp1; |
|
235 units_list *unit; |
233 units_list *unit; |
236 int rc, run = 1, seconds = 0; |
234 int rc, run = 1, seconds = 0; |
237 #ifdef HAVE_WIRINGPI_H |
235 #ifdef HAVE_WIRINGPI_H |
238 struct tm *tm; |
236 struct tm *tm; |
239 int row; |
237 int row; |
267 t++; |
265 t++; |
268 #endif |
266 #endif |
269 } |
267 } |
270 |
268 |
271 #ifdef HAVE_WIRINGPI_H |
269 #ifdef HAVE_WIRINGPI_H |
272 rc = piThreadCreate(my_sensors_loop); |
|
273 #else |
|
274 rc = pthread_create(&threads[t], NULL, my_sensors_loop, (void *)t ); |
|
275 #endif |
|
276 if (rc) { |
|
277 fprintf(stderr, "my_sensors_loop thread didn't start rc=%d\n", rc); |
|
278 syslog(LOG_NOTICE, "my_sensors_loop thread didn't start rc=%d", rc); |
|
279 #ifndef HAVE_WIRINGPI_H |
|
280 } else { |
|
281 t++; |
|
282 #endif |
|
283 } |
|
284 |
|
285 #ifdef HAVE_WIRINGPI_H |
|
286 rc = piThreadCreate(my_server_loop); |
270 rc = piThreadCreate(my_server_loop); |
287 #else |
271 #else |
288 rc = pthread_create(&threads[t], NULL, my_server_loop, (void *)t ); |
272 rc = pthread_create(&threads[t], NULL, my_server_loop, (void *)t ); |
289 #endif |
273 #endif |
290 if (rc) { |
274 if (rc) { |