thermferm/rdconfig.c

changeset 645
49eb753a958b
parent 615
33a5b63e86d7
child 666
48cc8868f9f4
--- a/thermferm/rdconfig.c	Sat Mar 23 09:31:01 2024 +0100
+++ b/thermferm/rdconfig.c	Sat Mar 23 12:18:14 2024 +0100
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2014-2022
+ * Copyright (C) 2014-2024
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -26,8 +26,9 @@
 #include "futil.h"
 #include "xutil.h"
 
-int		debug = FALSE;
-sys_config	Config;			/* System configuration		*/
+int			debug = FALSE;
+sys_config		Config;			/* System configuration		*/
+extern pthread_mutex_t  mutexes[5];
 
 #define MY_ENCODING "utf-8"
 
@@ -401,9 +402,7 @@
 
     if (Config.devices) {
 	xmlTextWriterStartElement(writer, BAD_CAST "DEVICES");
-#ifdef HAVE_WIRINGPI_H
-	piLock(LOCK_DEVICES);
-#endif
+	pthread_mutex_lock(&mutexes[LOCK_DEVICES]);
 	for (device = Config.devices; device; device = device->next) {
 	    xmlTextWriterStartElement(writer, BAD_CAST "DEVICE");
 	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", device->uuid);
@@ -421,9 +420,7 @@
 	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%d", (int)device->timestamp);
 	    xmlTextWriterEndElement(writer);	// close DEVICE
 	}
-#ifdef HAVE_WIRINGPI_H
-	piUnlock(LOCK_DEVICES);
-#endif
+	pthread_mutex_unlock(&mutexes[LOCK_DEVICES]);
 	xmlTextWriterEndElement(writer);	// close DEVICES
     }
 

mercurial