modbus/mb_runtime.c
changeset 4049 80fc760d4a4a
parent 3859 098875cff39f
--- a/modbus/mb_runtime.c	Wed Oct 16 15:45:15 2024 +0200
+++ b/modbus/mb_runtime.c	Wed Nov 13 14:42:34 2024 +0100
@@ -688,6 +688,9 @@
 			int res = 0;
 			pthread_attr_t attr;
 			res |= pthread_attr_init(&attr);
+#ifdef MODBUS_STACK_SIZE
+			res |= pthread_attr_setstacksize(&attr, MODBUS_STACK_SIZE);
+#endif
 			res |= pthread_create(&(client_nodes[index].timer_thread_id), &attr, &__mb_client_timer_thread, (void *)((char *)NULL + index));
 			if (res !=  0) {
 				fprintf(stderr, "Modbus plugin: Error (%%d) starting timer thread for modbus client node %%s\n", res, client_nodes[index].location);
@@ -701,6 +704,9 @@
 			int res = 0;
 			pthread_attr_t attr;
 			res |= pthread_attr_init(&attr);
+#ifdef MODBUS_STACK_SIZE
+			res |= pthread_attr_setstacksize(&attr, MODBUS_STACK_SIZE);
+#endif
 			res |= pthread_create(&(client_nodes[index].thread_id), &attr, &__mb_client_thread, (void *)((char *)NULL + index));
 			if (res !=  0) {
 				fprintf(stderr, "Modbus plugin: Error (%%d) starting thread for modbus client node %%s\n", res, client_nodes[index].location);
@@ -728,6 +734,9 @@
 			int res = 0;
 			pthread_attr_t attr;
 			res |= pthread_attr_init(&attr);
+#ifdef MODBUS_STACK_SIZE
+			res |= pthread_attr_setstacksize(&attr, MODBUS_STACK_SIZE);
+#endif
 			res |= pthread_create(&(server_nodes[index].thread_id), &attr, &__mb_server_thread, (void *)&(server_nodes[index]));
 			if (res !=  0) {
 				fprintf(stderr, "Modbus plugin: Error (%%d) starting modbus server thread for node %%s\n", res, server_nodes[index].location);