equal
deleted
inserted
replaced
688 int res = 0; |
688 int res = 0; |
689 pthread_attr_t attr; |
689 pthread_attr_t attr; |
690 res |= pthread_attr_init(&attr); |
690 res |= pthread_attr_init(&attr); |
691 res |= pthread_create(&(client_nodes[index].timer_thread_id), &attr, &__mb_client_timer_thread, (void *)((char *)NULL + index)); |
691 res |= pthread_create(&(client_nodes[index].timer_thread_id), &attr, &__mb_client_timer_thread, (void *)((char *)NULL + index)); |
692 if (res != 0) { |
692 if (res != 0) { |
693 fprintf(stderr, "Modbus plugin: Error starting timer thread for modbus client node %%s\n", client_nodes[index].location); |
693 fprintf(stderr, "Modbus plugin: Error (%%d) starting timer thread for modbus client node %%s\n", res, client_nodes[index].location); |
694 goto error_exit; |
694 goto error_exit; |
695 } |
695 } |
696 } |
696 } |
697 client_nodes[index].init_state = 4; // we have created the timer |
697 client_nodes[index].init_state = 4; // we have created the timer |
698 |
698 |
701 int res = 0; |
701 int res = 0; |
702 pthread_attr_t attr; |
702 pthread_attr_t attr; |
703 res |= pthread_attr_init(&attr); |
703 res |= pthread_attr_init(&attr); |
704 res |= pthread_create(&(client_nodes[index].thread_id), &attr, &__mb_client_thread, (void *)((char *)NULL + index)); |
704 res |= pthread_create(&(client_nodes[index].thread_id), &attr, &__mb_client_thread, (void *)((char *)NULL + index)); |
705 if (res != 0) { |
705 if (res != 0) { |
706 fprintf(stderr, "Modbus plugin: Error starting thread for modbus client node %%s\n", client_nodes[index].location); |
706 fprintf(stderr, "Modbus plugin: Error (%%d) starting thread for modbus client node %%s\n", res, client_nodes[index].location); |
707 goto error_exit; |
707 goto error_exit; |
708 } |
708 } |
709 } |
709 } |
710 client_nodes[index].init_state = 5; // we have created the thread |
710 client_nodes[index].init_state = 5; // we have created the thread |
711 } |
711 } |
728 int res = 0; |
728 int res = 0; |
729 pthread_attr_t attr; |
729 pthread_attr_t attr; |
730 res |= pthread_attr_init(&attr); |
730 res |= pthread_attr_init(&attr); |
731 res |= pthread_create(&(server_nodes[index].thread_id), &attr, &__mb_server_thread, (void *)&(server_nodes[index])); |
731 res |= pthread_create(&(server_nodes[index].thread_id), &attr, &__mb_server_thread, (void *)&(server_nodes[index])); |
732 if (res != 0) { |
732 if (res != 0) { |
733 fprintf(stderr, "Modbus plugin: Error starting modbus server thread for node %%s\n", server_nodes[index].location); |
733 fprintf(stderr, "Modbus plugin: Error (%%d) starting modbus server thread for node %%s\n", res, server_nodes[index].location); |
734 goto error_exit; |
734 goto error_exit; |
735 } |
735 } |
736 } |
736 } |
737 server_nodes[index].init_state = 2; // we have created the node and thread |
737 server_nodes[index].init_state = 2; // we have created the node and thread |
738 } |
738 } |