]> Kevux Git Server - fll/commitdiff
Workaround: weird print data when received by a pipe.
authorKevin Day <thekevinday@gmail.com>
Fri, 9 Apr 2021 00:51:14 +0000 (19:51 -0500)
committerKevin Day <thekevinday@gmail.com>
Fri, 9 Apr 2021 00:51:14 +0000 (19:51 -0500)
Not sure what is going on here, but it seems that the data is not correctly printing via pipes.
Add a flush before unlocking the print locks as workaround.

level_3/controller/c/private-common.c
level_3/controller/c/private-common.h
level_3/controller/c/private-controller.c
level_3/controller/c/private-entry.c
level_3/controller/c/private-rule.c
level_3/controller/c/private-thread.c

index a2ccf1929a2af6a7cbc9596b5a670604a207055d..12cf932632b3cad377ff8ad6d7a52aae22c57510 100644 (file)
@@ -91,7 +91,7 @@ extern "C" {
 
       fll_error_print(print, status, function, fallback);
 
-      f_thread_mutex_unlock(&thread->lock.print);
+      controller_print_unlock_flush(print.to.stream, &thread->lock.print);
     }
   }
 #endif // _di_controller_error_print_
@@ -163,6 +163,18 @@ extern "C" {
   }
 #endif // _di_controller_lock_delete_simple_
 
+#ifndef _di_controller_print_unlock_flush_
+  void controller_print_unlock_flush(FILE * const stream, f_thread_mutex_t *mutex) {
+
+    if (stream == 0 || mutex == 0) {
+      return;
+    }
+
+    fflush(stream);
+    f_thread_mutex_unlock(mutex);
+  }
+#endif // _di_controller_print_unlock_flush_
+
 #ifndef _di_controller_process_delete_simple_
   void controller_process_delete_simple(controller_process_t *process) {
 
index 5789aff7bf2705a483e6798d3b75056b28c9a14e..162e65e6cea404d509901f61ddc06162504fbd8b 100644 (file)
@@ -1318,6 +1318,23 @@ extern "C" {
 #endif // _di_controller_lock_delete_simple_
 
 /**
+ * Flush the stream buffer and then unlock the mutex.
+ *
+ * Weird behavior was observed when piping data from this program.
+ * The behavior appears related to how this handles locks in addition to the file streams own locking mechanisms.
+ *
+ * As a work-around, this performs a flush immediately before unlocking the print mutex.
+ *
+ * @param stream
+ *   The output stream to flush.
+ * @param mutex
+ *   The print mutex to unlock.
+ */
+#ifndef _di_controller_print_unlock_flush_
+  void controller_print_unlock_flush(FILE * const stream, f_thread_mutex_t *mutex) f_gcc_attribute_visibility_internal;
+#endif // _di_controller_print_unlock_flush_
+
+/**
  * Fully deallocate all memory for the given process without caring about return status.
  *
  * @param process
index 47538fcdc59476eb99b61fbf4dbf528d8a03cb7f..e8da949c090a27048bb5c75304bc0a18b0a6af2f 100644 (file)
@@ -106,7 +106,7 @@ extern "C" {
 
         fll_error_file_print(main.data->error, F_status_set_fine(status), "f_file_stream_open", F_true, path, "open", fll_error_file_type_file);
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
       }
     }
     else {
@@ -118,7 +118,7 @@ extern "C" {
 
           fll_error_file_print(main.data->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, "read", fll_error_file_type_file);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
       }
     }
@@ -136,7 +136,7 @@ extern "C" {
 
           fll_error_file_print(main.data->error, F_status_set_fine(status), "f_file_stat", F_true, path, "stat", fll_error_file_type_file);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
       }
       else {
@@ -366,7 +366,7 @@ extern "C" {
 
             controller_entry_error_print_cache(main.data->error, cache->action);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           return status;
@@ -379,7 +379,7 @@ extern "C" {
 
           controller_entry_error_print_cache(main.data->warning, cache->action);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         status = F_none;
@@ -467,7 +467,7 @@ extern "C" {
 
               controller_entry_error_print_cache(main.data->warning, cache->action);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
           }
 
@@ -500,7 +500,7 @@ extern "C" {
 
                     controller_entry_error_print_cache(main.data->error, cache->action);
 
-                    f_thread_mutex_unlock(&main.thread->lock.print);
+                    controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
                   }
 
                   if (F_status_is_error_not(status)) {
@@ -563,7 +563,7 @@ extern "C" {
 
                 controller_entry_error_print_cache(main.data->error, cache->action);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               if (F_status_is_error_not(status)) {
@@ -683,7 +683,7 @@ extern "C" {
         fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.title.before->string, controller_string_main_s, main.data->context.set.title.after->string);
         fprintf(main.data->output.stream, "'.%c", f_string_eol_s[0]);
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
       }
     }
 
@@ -725,7 +725,7 @@ extern "C" {
 
                 fprintf(main.data->output.stream, "' is %s and is in a %sfailed%s state, skipping execution.%c", entry_action->code & controller_entry_rule_code_require ? "required" : "optional", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else if (entry_action->code & controller_entry_rule_code_require) {
@@ -750,7 +750,7 @@ extern "C" {
 
                 controller_entry_error_print_cache(main.data->error, cache->action);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               return F_status_is_error(F_require);
@@ -775,7 +775,7 @@ extern "C" {
 
               controller_entry_error_print_cache(main.data->warning, cache->action);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
           }
           else {
@@ -796,7 +796,7 @@ extern "C" {
 
                 fprintf(main.data->output.stream, "' is in a %sfailed%s state, skipping.%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else if (main.data->warning.verbosity == f_console_verbosity_debug) {
@@ -817,7 +817,7 @@ extern "C" {
 
               controller_entry_error_print_cache(main.data->warning, cache->action);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
           }
 
@@ -837,7 +837,7 @@ extern "C" {
                 fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.title.before->string, controller_string_ready_s, main.data->context.set.title.after->string);
                 fprintf(main.data->output.stream, "'.%c", f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else {
@@ -857,7 +857,7 @@ extern "C" {
               fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.title.before->string, controller_string_ready_s, main.data->context.set.title.after->string);
               fprintf(main.data->output.stream, "', state already is ready.%c", f_string_eol_s[0]);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
           }
         }
@@ -876,7 +876,7 @@ extern "C" {
 
               controller_entry_error_print_cache(main.data->error, cache->action);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
 
             return F_status_is_error(F_critical);
@@ -922,7 +922,7 @@ extern "C" {
               fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.title.before->string, cache->action.name_item.string, main.data->context.set.title.after->string);
               fprintf(main.data->output.stream, "'.%c", f_string_eol_s[0]);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
           }
 
@@ -967,7 +967,7 @@ extern "C" {
               fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.title.before->string, alias_rule.string, main.data->context.set.title.after->string);
               fprintf(main.data->output.stream, "'.%c", f_string_eol_s[0]);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
           }
 
@@ -1017,7 +1017,7 @@ extern "C" {
 
                 controller_entry_error_print_cache(main.data->error, cache->action);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               if (!simulate) {
@@ -1138,7 +1138,7 @@ extern "C" {
               fprintf(main.data->output.stream, "%s%llu%s", main.data->context.set.important.before->string, entry_action->number, main.data->context.set.important.after->string);
               fprintf(main.data->output.stream, "' MegaTime (milliseconds).%c", f_string_eol_s[0]);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
           }
 
@@ -1167,7 +1167,7 @@ extern "C" {
 
               controller_entry_error_print_cache(main.data->error, cache->action);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
 
             return F_status_is_error(F_critical);
@@ -1187,7 +1187,7 @@ extern "C" {
                 fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.important.before->string, main.setting->entry.items.array[main.setting->failsafe_rule_id].name.string, main.data->context.set.important.after->string);
                 fprintf(main.data->output.stream, "'.%c", f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
           }
@@ -1247,7 +1247,7 @@ extern "C" {
         fprintf(main.data->output.stream, "%s%s%s", main.data->context.set.title.before->string, controller_string_main_s, main.data->context.set.title.after->string);
         fprintf(main.data->output.stream, "'.%c%c", f_string_eol_s[0], f_string_eol_s[0]);
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
       }
     }
 
index 381611851ccce80b4519c9ec18cde7f5238f892f..7720c06132e7143f7b03f570bff78ec1107867a6 100644 (file)
@@ -549,7 +549,7 @@ extern "C" {
       fll_error_print(print, status, function, fallback);
       controller_entry_error_print_cache(print, cache);
 
-      f_thread_mutex_unlock(&thread->lock.print);
+      controller_print_unlock_flush(print.to.stream, &thread->lock.print);
     }
   }
 #endif // _di_controller_entry_error_print_
@@ -673,7 +673,7 @@ extern "C" {
           fprintf(main.data->error.to.stream, "%c", f_string_eol_s[0]);
           fprintf(main.data->error.to.stream, "%s%sThe entry file is empty.%s%c", main.data->error.context.before->string, main.data->error.prefix ? main.data->error.prefix : f_string_empty_s, main.data->error.context.after->string, f_string_eol_s[0]);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         status = F_status_set_error(F_data_not);
@@ -762,7 +762,7 @@ extern "C" {
 
                 controller_entry_error_print_cache(main.data->warning, cache->action);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               code |= 0x2;
@@ -811,7 +811,7 @@ extern "C" {
 
             controller_entry_error_print_cache(main.data->error, cache->action);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
             if (F_status_set_fine(status) == F_memory_not) {
               break;
@@ -832,7 +832,7 @@ extern "C" {
               fprintf(main.data->error.to.stream, "%s%s%s%s", main.data->error.context.after->string, main.data->error.notable.before->string, controller_string_main_s, main.data->error.notable.after->string);
               fprintf(main.data->error.to.stream, "%s' was not found.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
 
             status = F_status_set_error(F_found_not);
@@ -896,7 +896,7 @@ extern "C" {
 
                       controller_entry_error_print_cache(main.data->error, cache->action);
 
-                      f_thread_mutex_unlock(&main.thread->lock.print);
+                      controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
                     }
 
                     action->number = 0;
index 3c62c3eb6d81983bcfd4b127111cbe3e4ca96e54..99499d86272a99a47b06ae3a341bef1579b5cbbe 100644 (file)
@@ -426,7 +426,7 @@ extern "C" {
 
         controller_rule_error_print_cache(main.data->warning, cache->action, F_true);
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
       }
     }
 
@@ -614,7 +614,7 @@ extern "C" {
       fll_error_print(print, status, function, fallback);
       controller_rule_error_print_cache(print, cache, item);
 
-      f_thread_mutex_unlock(&thread->lock.print);
+      controller_print_unlock_flush(print.to.stream, &thread->lock.print);
     }
   }
 #endif // _di_controller_rule_error_print_
@@ -662,7 +662,7 @@ extern "C" {
 
       controller_rule_error_print_cache(output, cache, item);
 
-      f_thread_mutex_unlock(&thread->lock.print);
+      controller_print_unlock_flush(output.to.stream, &thread->lock.print);
     }
   }
 #endif // _di_controller_rule_item_error_print_
@@ -938,7 +938,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (success == F_false) {
@@ -996,7 +996,7 @@ extern "C" {
         fprintf(main.data->output.stream, "%s%s%s", main.data->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, main.data->context.reset.string);
         fprintf(main.data->output.stream, "%s'.%c", main.data->context.reset.string, f_string_eol_s[0]);
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
       }
 
       // sleep for less than a second to better show simulation of synchronous vs asynchronous.
@@ -1076,7 +1076,7 @@ extern "C" {
         controller_error_print(main.data->error, F_status_set_fine(status), "fll_execute_program", F_true, main.thread);
       }
 
-      f_thread_mutex_unlock(&main.thread->lock.print);
+      controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
       status = F_status_set_error(status);
     }
@@ -1118,7 +1118,7 @@ extern "C" {
         fprintf(main.data->output.stream, "%s%s%s", main.data->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, main.data->context.reset.string);
         fprintf(main.data->output.stream, "%s'.%c", main.data->context.reset.string, f_string_eol_s[0]);
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
       }
 
       // sleep for less than a second to better show simulation of synchronous vs asynchronous.
@@ -1198,7 +1198,7 @@ extern "C" {
         controller_error_print(main.data->error, F_status_set_fine(status), "fll_execute_program", F_true, main.thread);
       }
 
-      f_thread_mutex_unlock(&main.thread->lock.print);
+      controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
       return F_status_set_error(status);
     }
@@ -1364,7 +1364,7 @@ extern "C" {
 
           controller_rule_error_print_cache(main.data->warning, cache->action, F_true);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         continue;
@@ -1383,7 +1383,7 @@ extern "C" {
             fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
             fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           status = F_status_set_error(F_supported_not);
@@ -1585,7 +1585,7 @@ extern "C" {
 
           controller_rule_error_print_cache(main.data->error, process->cache.action, F_true);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         return F_status_set_error(F_parameter);
@@ -1698,7 +1698,7 @@ extern "C" {
               controller_rule_item_error_print_need_want_wish(main.data->error, strings[i], dynamics[i]->array[j].string, "was not found");
               controller_rule_error_print_cache(main.data->error, process->cache.action, F_true);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
               status = F_status_set_error(F_found_not);
 
@@ -1715,7 +1715,7 @@ extern "C" {
                 controller_rule_item_error_print_need_want_wish(main.data->warning, strings[i], dynamics[i]->array[j].string, "was not found");
                 controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
 
@@ -1778,7 +1778,7 @@ extern "C" {
                   controller_rule_item_error_print_need_want_wish(main.data->error, strings[i], alias_other_buffer, "failed during execution");
                   controller_rule_error_print_cache(main.data->error, process->cache.action, F_true);
 
-                  f_thread_mutex_unlock(&main.thread->lock.print);
+                  controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
                   if (!(process->options & controller_rule_option_simulate) || F_status_set_fine(status) == F_memory_not) {
                     f_thread_unlock(&process_other->active);
@@ -1793,7 +1793,7 @@ extern "C" {
                     controller_rule_item_error_print_need_want_wish(main.data->warning, strings[i], alias_other_buffer, "failed during execution");
                     controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true);
 
-                    f_thread_mutex_unlock(&main.thread->lock.print);
+                    controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
                   }
                 }
               }
@@ -1811,7 +1811,7 @@ extern "C" {
                 status = F_status_set_error(F_found_not);
                 controller_rule_error_print_cache(main.data->error, process->cache.action, F_true);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
                 if (!(process->options & controller_rule_option_simulate)) {
                   f_thread_unlock(&main.thread->lock.rule);
@@ -1825,7 +1825,7 @@ extern "C" {
                   controller_rule_item_error_print_need_want_wish(main.data->warning, strings[i], alias_other_buffer, "is in a failed state");
                   controller_rule_error_print_cache(main.data->warning, process->cache.action, F_true);
 
-                  f_thread_mutex_unlock(&main.thread->lock.print);
+                  controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
                 }
               }
             }
@@ -1891,7 +1891,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, process->cache.action, F_true);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           status = F_status_set_error(F_parameter);
@@ -1976,7 +1976,7 @@ extern "C" {
           controller_rule_item_error_print_rule_not_loaded(main.data->error, alias_rule.string);
           controller_rule_error_print_cache(main.data->error, cache.action, F_false);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         return status;
@@ -2157,7 +2157,7 @@ extern "C" {
 
               controller_rule_error_print_cache(main.data->error, process->cache.action, F_true);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
 
             // never continue on circular recursion errors even in simulate mode.
@@ -2220,7 +2220,7 @@ extern "C" {
         controller_rule_item_error_print_rule_not_loaded(main.data->error, process->rule.alias.string);
         controller_rule_error_print_cache(main.data->error, process->cache.action, F_false);
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
       }
     }
 
@@ -2658,7 +2658,7 @@ extern "C" {
 
           controller_rule_error_print_cache(main.data->warning, cache->action, F_false);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         continue;
@@ -2679,7 +2679,7 @@ extern "C" {
 
           controller_rule_error_print_cache(main.data->warning, cache->action, F_false);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         continue;
@@ -2742,7 +2742,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -2798,7 +2798,7 @@ extern "C" {
                   f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]);
                   fprintf(main.data->error.to.stream, "%s%s', the number is too large for this system.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                  f_thread_mutex_unlock(&main.thread->lock.print);
+                  controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
                 }
                 else {
                   f_thread_mutex_lock(&main.thread->lock.print);
@@ -2809,7 +2809,7 @@ extern "C" {
                   f_print_dynamic_partial(main.data->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]);
                   fprintf(main.data->error.to.stream, "%s%s', only whole numbers are allowed for an affinity value.%s%c", main.data->error.notable.after->string, main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                  f_thread_mutex_unlock(&main.thread->lock.print);
+                  controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
                 }
 
                 // get the current line number within the settings item.
@@ -2864,7 +2864,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -2989,7 +2989,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3023,7 +3023,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3115,7 +3115,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3192,7 +3192,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_true);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3220,7 +3220,7 @@ extern "C" {
 
               controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
 
             status = F_status_set_error(F_valid_not);
@@ -3295,7 +3295,7 @@ extern "C" {
 
                 controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               status = F_status_set_error(F_valid_not);
@@ -3359,7 +3359,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3419,7 +3419,7 @@ extern "C" {
 
                   controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-                  f_thread_mutex_unlock(&main.thread->lock.print);
+                  controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
                 }
 
                 if (F_status_is_error_not(status_return)) {
@@ -3432,7 +3432,7 @@ extern "C" {
                 // this function should only return F_complete_not_utf on error.
                 controller_rule_error_print(main.data->error, cache->action, F_complete_not_utf, "controller_validate_has_graph", F_true, F_false, main.thread);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
                 if (F_status_is_error_not(status_return)) {
                   status_return = status;
@@ -3511,7 +3511,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3563,7 +3563,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3616,7 +3616,7 @@ extern "C" {
 
                 controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               if (F_status_is_error_not(status_return)) {
@@ -3661,7 +3661,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3689,7 +3689,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -3716,7 +3716,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -3744,7 +3744,7 @@ extern "C" {
 
               controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
 
               status_return = status;
               break;
@@ -3764,7 +3764,7 @@ extern "C" {
 
               controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-              f_thread_mutex_unlock(&main.thread->lock.print);
+              controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
             }
 
             if (F_status_is_error_not(status_return)) {
@@ -3805,7 +3805,7 @@ extern "C" {
 
                 controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               if (F_status_is_error_not(status_return)) {
@@ -3845,7 +3845,7 @@ extern "C" {
                 fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
                 fprintf(main.data->error.to.stream, "%s' because no user was found by that name.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else if (status == F_number_too_large) {
@@ -3859,7 +3859,7 @@ extern "C" {
                 fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
                 fprintf(main.data->error.to.stream, "%s' because the given ID is too large.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else if (status == F_number) {
@@ -3873,7 +3873,7 @@ extern "C" {
                 fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
                 fprintf(main.data->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else {
@@ -3917,7 +3917,7 @@ extern "C" {
 
             controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-            f_thread_mutex_unlock(&main.thread->lock.print);
+            controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -3974,7 +3974,7 @@ extern "C" {
                 fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
                 fprintf(main.data->error.to.stream, "%s' because no group was found by that name.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else if (status == F_number_too_large) {
@@ -3988,7 +3988,7 @@ extern "C" {
                 fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
                 fprintf(main.data->error.to.stream, "%s' because the given ID is too large.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else if (status == F_number) {
@@ -4002,7 +4002,7 @@ extern "C" {
                 fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
                 fprintf(main.data->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
             }
             else {
@@ -4124,7 +4124,7 @@ extern "C" {
 
                 controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-                f_thread_mutex_unlock(&main.thread->lock.print);
+                controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
               }
 
               if (F_status_is_error_not(status_return)) {
@@ -4176,7 +4176,7 @@ extern "C" {
 
           controller_rule_error_print_cache(main.data->error, cache->action, F_false);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         if (F_status_is_error_not(status_return)) {
@@ -4283,7 +4283,7 @@ extern "C" {
           fprintf(main.data->error.to.stream, "%s", main.data->error.notable.after->string);
           fprintf(main.data->error.to.stream, "%s'.%s%c", main.data->error.context.before->string, main.data->error.context.after->string, f_string_eol_s[0]);
 
-          f_thread_mutex_unlock(&main.thread->lock.print);
+          controller_print_unlock_flush(main.data->output.stream, &main.thread->lock.print);
         }
 
         setting_values->array[setting_values->used].used = 0;
@@ -4332,7 +4332,7 @@ extern "C" {
           controller_rule_error_print_cache(data->error, cache->action, F_true);
         }
 
-        f_thread_mutex_unlock(&main.thread->lock.print);
+        controller_print_unlock_flush(data->output.stream, &main.thread->lock.print);
 
         return;
     }
@@ -4597,7 +4597,7 @@ extern "C" {
 
     fprintf(data->output.stream, "}%c", f_string_eol_s[0]);
 
-    f_thread_mutex_unlock(&main.thread->lock.print);
+    controller_print_unlock_flush(data->output.stream, &main.thread->lock.print);
   }
 #endif // _di_controller_rule_validate_
 
index 6dd8f18cb20866202965d53721b72787ed84930a..f4dbb16b77c4acbf58e76b807b6608aebda29d73 100644 (file)
@@ -199,7 +199,7 @@ extern "C" {
             fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, setting->path_pid.string, data->error.notable.after->string);
             fprintf(data->error.to.stream, "%s' must not already exist.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]);
 
-            f_thread_mutex_unlock(&thread.lock.print);
+            controller_print_unlock_flush(data->error.to.stream, &thread.lock.print);
           }
 
           setting->ready = controller_setting_ready_abort;
@@ -469,7 +469,7 @@ extern "C" {
             fprintf(data->error.to.stream, "%s%s%s%s", data->error.context.after->string, data->error.notable.before->string, entry->setting->path_pid.string, data->error.notable.after->string);
             fprintf(data->error.to.stream, "%s' must not already exist.%s%c", data->error.context.before->string, data->error.context.after->string, f_string_eol_s[0]);
 
-            f_thread_mutex_unlock(&entry->main->thread->lock.print);
+            controller_print_unlock_flush(data->error.to.stream, &entry->main->thread->lock.print);
           }
 
           entry->setting->ready = controller_setting_ready_fail;