I am thinking of doing some redesigning of the locking/unlocking processes after this commit.
I may end up adding a new type to the FLL project to standardize a more complex structure.
I believe I need to create a read/write lock pair with a mutex lock so that the mutex can be used to prep a lock for transitioning from a read to a write or a write to a read.
I need to do some more extensive planning.
#endif // _di_controller_allocation_d_
/**
+ * Controller lock check flags.
+ *
+ * controller_lock_check_flag_*_d:
+ * - no: Do not perform any checks; only return on success (or initial parameter errors before calling locks or waits).
+ * - yes: Perform all checks and return (error check and enabled/disable check).
+ * - error: Only perform error check and return.
+ */
+#ifndef _di_controller_lock_check_flag_d_
+ #define controller_lock_check_flag_no_d 0x0
+ #define controller_lock_check_flag_yes_d 0x1
+ #define controller_lock_check_flag_error_d 0x2
+#endif // _di_controller_lock_check_flag_d_
+
+/**
* Controller lock defines.
*
* controller_lock_*_d:
f_thread_mutex_delete(&lock->alert);
f_thread_mutex_delete(&lock->cancel);
+ f_thread_mutex_delete(&lock->entry);
f_thread_mutex_delete(&lock->print);
f_thread_mutex_delete(&lock->reap);
* - flag: A set of flags associated with the locks.
* - alert: The alert mutex lock for waking up on alerts.
* - cancel: The cancel mutex lock for locking the cancel operation.
+ * - entry: The entry mutex lock for entry reading (preventing entry and exit from overlapping).
* - print: The print mutex lock.
* - reap: The reap_condition mutex lock.
* - enable: The enable r/w lock.
f_thread_mutex_t alert;
f_thread_mutex_t cancel;
+ f_thread_mutex_t entry;
f_thread_mutex_t print;
f_thread_mutex_t reap;
f_thread_mutex_t_initialize, \
f_thread_mutex_t_initialize, \
f_thread_mutex_t_initialize, \
+ f_thread_mutex_t_initialize, \
f_thread_lock_t_initialize, \
f_thread_lock_t_initialize, \
f_thread_lock_t_initialize, \
if (!main) return F_status_set_error(F_parameter);
+ f_status_t status = controller_lock_mutex_standard(is_entry, controller_lock_check_flag_yes_d, &main->thread, &main->thread.lock.entry);
+ if (F_status_is_error(status)) return status;
+
+ status = controller_entry_read_do(main, is_entry);
+
+ f_thread_mutex_unlock(&main->thread.lock.entry);
+
+ return status;
+ }
+#endif // _di_controller_entry_read_
+
+#ifndef _di_controller_entry_read_do_
+ f_status_t controller_entry_read_do(controller_t * const main, const uint8_t is_entry) {
+
+ if (!main) return F_status_set_error(F_parameter);
+
controller_entry_t * const entry = is_entry ? &main->process.entry : &main->process.exit;
controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_entry, main);
return entry->status;
}
-#endif // _di_controller_entry_read_
+#endif // _di_controller_entry_read_do_
#ifdef __cplusplus
} // extern "C"
#endif
/**
+ * Read the entry, extracting all lists, with locking.
+ *
+ * This wraps controller_entry_read_do() with a mutex lock to prevent double execution.
+ *
+ * @param main
+ * The main program data.
+ *
+ * This does not alter main.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
+ *
+ * @return
+ * Success from controller_entry_read_do().
+ *
+ * Errors (with error bit) from: controller_entry_read_do().
+ * Errors (with error bit) from: controller_lock_mutex_standard().
+ *
+ * @see controller_entry_read_do()
+ * @see controller_lock_mutex_standard()
+ */
+#ifndef _di_controller_entry_read_
+ extern f_status_t controller_entry_read(controller_t * const main, const uint8_t is_entry);
+#endif // _di_controller_entry_read_
+
+/**
* Read the entry, extracting all lists.
*
* @param main
* @see f_fss_apply_delimit()
* @see fll_fss_basic_list_read()
*/
-#ifndef _di_controller_entry_read_
- extern f_status_t controller_entry_read(controller_t * const main, const uint8_t is_entry);
-#endif // _di_controller_entry_read_
+#ifndef _di_controller_entry_read_do_
+ extern f_status_t controller_entry_read_do(controller_t * const main, const uint8_t is_entry);
+#endif // _di_controller_entry_read_do_
#ifdef __cplusplus
} // extern "C"
break;
}
else if (entry_action->type == controller_entry_action_type_consider_e || controller_entry_action_type_is_rule(entry_action->type)) {
- status_lock = controller_lock_write_standard(is_entry, F_true, &main->thread, &main->thread.lock.rule);
+ status_lock = controller_lock_write_standard(is_entry, controller_lock_check_flag_yes_d, &main->thread, &main->thread.lock.rule);
if (status_lock != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
id_rule_name[entry_action->parameters.array[0].used] = f_path_separator_s.string[0];
id_rule_name[id_rule_length] = 0;
- status_lock = controller_lock_read_standard(is_entry, F_true, &main->thread, &main->thread.lock.rule);
+ status_lock = controller_lock_read_standard(is_entry, controller_lock_check_flag_yes_d, &main->thread, &main->thread.lock.rule);
if (status_lock != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
memcpy(cache_name_item, cache->action.name_item.string, sizeof(f_char_t) * cache->action.name_item.used);
memcpy(cache_name_file, cache->action.name_file.string, sizeof(f_char_t) * cache->action.name_file.used);
- status_lock = controller_lock_write_standard(is_entry, F_true, &main->thread, &main->thread.lock.rule);
+ status_lock = controller_lock_write_standard(is_entry, controller_lock_check_flag_yes_d, &main->thread, &main->thread.lock.rule);
if (status_lock == F_okay) {
status = controller_rule_read(main, cache, is_entry, alias_rule, entry, &main->process.rules.array[main->process.rules.used]);
if (controller_instance_find(action, alias, main->thread.instances, id) == F_false) {
f_thread_unlock(&main->thread.lock.instance);
- status = controller_lock_write_standard(is_normal, F_true, &main->thread, &main->thread.lock.instance);
+ status = controller_lock_write_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &main->thread.lock.instance);
if (status != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status), F_false);
controller_instance_t * const instance = F_status_is_error_not(status) ? main->thread.instances.array[main->thread.instances.used] : 0;
if (status == F_okay) {
- status = controller_lock_write_standard(is_normal, F_true, &main->thread, &instance->lock);
+ status = controller_lock_write_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &instance->lock);
}
if (F_status_is_error(status)) {
}
// The read lock must be restored on return.
- const f_status_t status_restore = F_status_is_error(controller_lock_read_standard(is_normal, F_false, &main->thread, &main->thread.lock.instance))
+ const f_status_t status_restore = F_status_is_error(controller_lock_read_standard(is_normal, controller_lock_check_flag_no_d, &main->thread, &main->thread.lock.instance))
? F_status_set_error(F_lock_read)
: F_okay;
status = f_thread_mutex_create(0, &lock->cancel);
if (F_status_is_error_not(status)) {
- status = f_thread_mutex_create(0, &lock->print);
+ status = f_thread_mutex_create(0, &lock->entry);
if (F_status_is_error_not(status)) {
- status = f_thread_mutex_create(0, &lock->reap);
+ status = f_thread_mutex_create(0, &lock->print);
if (F_status_is_error_not(status)) {
- status = f_thread_lock_create(0, &lock->enable);
+ status = f_thread_mutex_create(0, &lock->reap);
if (F_status_is_error_not(status)) {
- status = f_thread_lock_create(0, &lock->instance);
+ status = f_thread_lock_create(0, &lock->enable);
if (F_status_is_error_not(status)) {
- status = f_thread_lock_create(0, &lock->rule);
+ status = f_thread_lock_create(0, &lock->instance);
if (F_status_is_error_not(status)) {
- status = f_thread_condition_create(0, &lock->alert_condition);
+ status = f_thread_lock_create(0, &lock->rule);
if (F_status_is_error_not(status)) {
- status = f_thread_condition_create(0, &lock->reap_condition);
+ status = f_thread_condition_create(0, &lock->alert_condition);
+
+ if (F_status_is_error_not(status)) {
+ status = f_thread_condition_create(0, &lock->reap_condition);
+
+ if (F_status_is_error(status)) {
+ f_thread_condition_delete(&lock->alert_condition);
+ }
+ }
if (F_status_is_error(status)) {
- f_thread_condition_delete(&lock->alert_condition);
+ f_thread_lock_delete(&lock->rule);
}
}
if (F_status_is_error(status)) {
- f_thread_lock_delete(&lock->rule);
+ f_thread_lock_delete(&lock->instance);
}
}
if (F_status_is_error(status)) {
- f_thread_lock_delete(&lock->instance);
+ f_thread_lock_delete(&lock->enable);
}
}
if (F_status_is_error(status)) {
- f_thread_lock_delete(&lock->enable);
+ f_thread_mutex_delete(&lock->reap);
}
}
if (F_status_is_error(status)) {
- f_thread_mutex_delete(&lock->reap);
+ f_thread_mutex_delete(&lock->print);
}
}
if (F_status_is_error(status)) {
- f_thread_mutex_delete(&lock->print);
+ f_thread_mutex_delete(&lock->entry);
}
}
if (status == F_time) {
if (check) {
- if (check == 0x2) {
+ if (check == controller_lock_check_flag_error_d) {
if (F_status_is_error(status)) return status;
}
else if (!controller_thread_enable_is(thread, is_normal)) return F_status_set_error(F_interrupt);
if (!instance) return F_status_set_error(F_parameter);
- return controller_lock_mutex_standard(instance->type != controller_instance_type_exit_e, F_true, &instance->main->thread, mutex);
+ return controller_lock_mutex_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_yes_d, &instance->main->thread, mutex);
}
#endif // _di_controller_lock_mutex_instance_
if (status == F_time) {
if (check) {
- if (check == 0x2) {
+ if (check == controller_lock_check_flag_error_d) {
if (F_status_is_error(status)) return status;
}
else if (!controller_thread_enable_is(thread, is_normal)) return F_status_set_error(F_interrupt);
if (!instance || !instance->main) return F_status_set_error(F_parameter);
- return controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_true, &instance->main->thread, lock);
+ return controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_yes_d, &instance->main->thread, lock);
}
#endif // _di_controller_lock_read_instance_
if (status == F_time) {
if (check) {
- if (check == 0x2) {
+ if (check == controller_lock_check_flag_error_d) {
if (F_status_is_error(status)) return status;
}
else if (!controller_thread_enable_is(thread, is_normal)) return F_status_set_error(F_interrupt);
if (!instance) return F_status_set_error(F_parameter);
- return controller_lock_write_standard(instance->type != controller_instance_type_exit_e, F_true, &instance->main->thread, lock);
+ return controller_lock_write_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_yes_d, &instance->main->thread, lock);
}
#endif // _di_controller_lock_write_instance_
* Given a mutex lock, periodically check to see if main thread is disabled while waiting.
*
* @param is_normal
- * If TRUE, then perform as if this operates during a normal operation (Entry and Control).
- * If FALSE, then perform as if this operates during a an Exit operation.
- * IF 0x2, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * IF controller_lock_check_flag_error_d, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * If controller_lock_check_flag_no_d, then do not check if the state is enabled and keep looping.
+ * If controller_lock_check_flag_yes_d, then check if the state is enabled and if it is not then abort.
* @param check
* If TRUE, then check if the state is enabled and if it is not then abort.
* If FALSE, then do not check if the state is enabled and keep looping.
* Given a mutex lock, periodically check to see if main thread is disabled while waiting.
*
* @param is_normal
- * If TRUE, then perform as if this operates during a normal operation (Entry and Control).
- * If FALSE, then perform as if this operates during a an Exit operation.
- * IF 0x2, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * IF controller_lock_check_flag_error_d, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * If controller_lock_check_flag_no_d, then do not check if the state is enabled and keep looping.
+ * If controller_lock_check_flag_yes_d, then check if the state is enabled and if it is not then abort.
* @param check
* If TRUE, then check if the state is enabled and if it is not then abort.
* If FALSE, then do not check if the state is enabled and keep looping.
* If TRUE, then perform as if this operates during a normal operation (Entry and Control).
* If FALSE, then perform as if this operates during a an Exit operation.
* @param check
- * If TRUE, then check if the state is enabled and if it is not then abort.
- * If FALSE, then do not check if the state is enabled and keep looping.
- * IF 0x2, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * IF controller_lock_check_flag_error_d, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * If controller_lock_check_flag_no_d, then do not check if the state is enabled and keep looping.
+ * If controller_lock_check_flag_yes_d, then check if the state is enabled and if it is not then abort.
* @param seconds
* The seconds to add to current time.
* @param nanoseconds
* If TRUE, then perform as if this operates during a normal operation (Entry and Control).
* If FALSE, then perform as if this operates during a an Exit operation.
* @param check
- * If TRUE, then check if the state is enabled and if it is not then abort.
- * If FALSE, then do not check if the state is enabled and keep looping.
- * IF 0x2, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * IF controller_lock_check_flag_error_d, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * If controller_lock_check_flag_no_d, then do not check if the state is enabled and keep looping.
+ * If controller_lock_check_flag_yes_d, then check if the state is enabled and if it is not then abort.
* @param thread
* The thread data used to determine if the main thread is disabled or not.
*
* If TRUE, then perform as if this operates during a normal operation (Entry and Control).
* If FALSE, then perform as if this operates during a an Exit operation.
* @param check
- * If TRUE, then check if the state is enabled and if it is not then abort.
- * If FALSE, then do not check if the state is enabled and keep looping.
- * IF 0x2, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * IF controller_lock_check_flag_error_d, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * If controller_lock_check_flag_no_d, then do not check if the state is enabled and keep looping.
+ * If controller_lock_check_flag_yes_d, then check if the state is enabled and if it is not then abort.
* @param seconds
* The seconds to add to current time.
* @param nanoseconds
* If TRUE, then perform as if this operates during a normal operation (Entry and Control).
* If FALSE, then perform as if this operates during a an Exit operation.
* @param check
- * If TRUE, then check if the state is enabled and if it is not then abort.
- * If FALSE, then do not check if the state is enabled and keep looping.
- * IF 0x2, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * IF controller_lock_check_flag_error_d, then this is is also TRUE, but it does not call controller_thread_enable_is() and returns on any lock error.
+ * If controller_lock_check_flag_no_d, then do not check if the state is enabled and keep looping.
+ * If controller_lock_check_flag_yes_d, then check if the state is enabled and if it is not then abort.
* @param thread
* The thread data used to determine if the main thread is disabled or not.
*
success = F_false;
if (F_status_set_fine(status) == F_lock_read) {
- status = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &main->thread, &instance->lock);
+ status = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &main->thread, &instance->lock);
if (status != F_okay) return F_status_set_error(F_lock_read);
status = F_status_set_error(F_lock);
f_execute_result_t result = f_execute_result_t_initialize;
// @fixme Lock the instance.childs.used with write access. (active should already have a read lock)
- //status = controller_lock_write_standard(instance->type != controller_instance_type_exit_e, F_false, &main->thread, &instance->lock);
+ //status = controller_lock_write_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &main->thread, &instance->lock);
//if (status != F_okay) return F_status_set_error(F_lock_read);
status = f_memory_array_increase(controller_allocation_small_d, sizeof(pid_t), (void **) &instance->childs.array, &instance->childs.used, &instance->childs.size);
if (F_status_is_error(status_lock)) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
- status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &instance->main->thread, &instance->lock);
+ status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &instance->main->thread, &instance->lock);
if (status_lock != F_okay) return F_status_set_error(F_lock_read);
return F_status_set_error(F_lock);
// Try again, after the first interrupt.
if (F_status_set_fine(status_lock) == F_interrupt) {
- status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &instance->main->thread, &instance->lock);
+ status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &instance->main->thread, &instance->lock);
}
if (status_lock != F_okay) {
f_execute_result_t result = f_execute_result_t_initialize;
// @fixme Lock the instance.childs.used with write access. (active should already have a read lock)
- //status = controller_lock_write_standard(instance->type != controller_instance_type_exit_e, F_false, &main->thread, &instance->lock);
+ //status = controller_lock_write_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &main->thread, &instance->lock);
//if (status != F_okay) return F_status_set_error(F_lock_read);
status = f_memory_array_increase(controller_allocation_small_d, sizeof(pid_t), (void **) &instance->childs.array, &instance->childs.used, &instance->childs.size);
if (status_lock != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
- status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &instance->main->thread, &instance->lock);
+ status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &instance->main->thread, &instance->lock);
if (status_lock != F_okay) return F_status_set_error(F_lock_read);
return F_status_set_error(F_lock);
if (status_lock != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
- status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &instance->main->thread, &instance->lock);
+ status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &instance->main->thread, &instance->lock);
if (status_lock != F_okay) return F_status_set_error(F_lock_read);
return F_status_set_error(F_lock);
if (F_status_is_error(status_lock)) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
- status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &main->thread, &instance->lock);
+ status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &main->thread, &instance->lock);
if (status_lock != F_okay) return F_status_set_error(F_lock_read);
return F_status_set_error(F_lock);
// Remove the write lock and restore the read lock.
f_thread_unlock(&instance->lock);
- status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &main->thread, &instance->lock);
+ status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &main->thread, &instance->lock);
if (status_lock != F_okay) return F_status_set_error(F_lock_read);
return F_status_set_error(F_lock);
if (F_status_is_error(status_lock)) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
- status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, F_false, &main->thread, &instance->lock);
+ status_lock = controller_lock_read_standard(instance->type != controller_instance_type_exit_e, controller_lock_check_flag_no_d, &main->thread, &instance->lock);
if (status_lock != F_okay) return F_status_set_error(F_lock_read);
return F_status_set_error(F_lock);
if (!main || !cache) return F_status_set_error(F_parameter);
if (!controller_thread_is_enabled_instance_type(&main->thread, type)) return F_status_set_error(F_interrupt);
- f_status_t status = controller_lock_read_standard(type != controller_instance_type_exit_e, F_true, &main->thread, &main->thread.lock.instance);
+ f_status_t status = controller_lock_read_standard(type != controller_instance_type_exit_e, controller_lock_check_flag_yes_d, &main->thread, &main->thread.lock.instance);
if (status != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status), F_true);
controller_instance_t * const instance = main->thread.instances.array[at];
- status = controller_lock_read_standard(type != controller_instance_type_exit_e, F_true, &main->thread, &instance->active);
+ status = controller_lock_read_standard(type != controller_instance_type_exit_e, controller_lock_check_flag_yes_d, &main->thread, &instance->active);
if (status != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status), F_true);
if (!main) return F_status_set_error(F_parameter);
- f_status_t status_lock = controller_lock_read_standard(is_normal, F_false, &main->thread, &main->thread.lock.instance);
+ f_status_t status_lock = controller_lock_read_standard(is_normal, controller_lock_check_flag_no_d, &main->thread, &main->thread.lock.instance);
if (status_lock != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
if (!controller_thread_enable_is(&main->thread, is_normal)) break;
// Re-establish instance read lock to wait for or protect from the cleanup thread while checking the read instance.
- status_lock = controller_lock_read_standard(is_normal, F_true, &main->thread, &main->thread.lock.instance);
+ status_lock = controller_lock_read_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &main->thread.lock.instance);
if (status_lock != F_okay) break;
if (!instance_list[i]) {
continue;
}
- status_lock = controller_lock_read_standard(is_normal, F_true, &main->thread, &instance_list[i]->active);
+ status_lock = controller_lock_read_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &instance_list[i]->active);
if (status_lock != F_okay) {
f_thread_unlock(&main->thread.lock.instance);
// Once the active lock is obtained, then the main instance read lock can be safely released.
f_thread_unlock(&main->thread.lock.instance);
- status_lock = controller_lock_read_standard(is_normal, F_true, &main->thread, &instance_list[i]->lock);
+ status_lock = controller_lock_read_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &instance_list[i]->lock);
if (status_lock != F_okay) {
f_thread_unlock(&instance_list[i]->active);
if (instance_list[i]->state == controller_instance_state_done_e) {
f_thread_unlock(&instance_list[i]->lock);
- status_lock = controller_lock_write_standard(is_normal, F_true, &main->thread, &instance_list[i]->lock);
+ status_lock = controller_lock_write_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &instance_list[i]->lock);
if (status_lock != F_okay) {
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
f_thread_condition_signal_all(&instance_list[i]->wait_condition);
}
- status_lock = controller_lock_read_standard(is_normal, F_true, &main->thread, &instance_list[i]->active);
+ status_lock = controller_lock_read_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &instance_list[i]->active);
if (status_lock != F_okay) {
f_thread_unlock(&instance_list[i]->lock);
f_thread_unlock(&instance_list[i]->lock);
- status_lock = controller_lock_read_standard(is_normal, F_true, &main->thread, &instance_list[i]->lock);
+ status_lock = controller_lock_read_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &instance_list[i]->lock);
if (status_lock != F_okay) break;
}
break;
}
- status_lock = controller_lock_read_standard(is_normal, F_true, &main->thread, &instance_list[i]->lock);
+ status_lock = controller_lock_read_standard(is_normal, controller_lock_check_flag_yes_d, &main->thread, &instance_list[i]->lock);
if (status_lock != F_okay) {
f_thread_unlock(&instance_list[i]->active);
if (!main) return;
- f_status_t status = controller_lock_mutex(is_normal, 0x2, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.cancel);
+ f_status_t status = controller_lock_mutex(is_normal, controller_lock_check_flag_error_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.cancel);
if (F_status_is_error(status)) return;
// Only cancel when enabled.
time.tv_nsec = interval_nanoseconds;
if (main->process.mode == controller_process_mode_helper_e && !(main->setting.flag & controller_main_flag_validate_d)) {
- controller_lock_read(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
+ controller_lock_read(is_normal, controller_lock_check_flag_no_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
for (i = 0; i < main->thread.instances.used; ++i) {
return;
}
- status = controller_lock_read(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
+ status = controller_lock_read(is_normal, controller_lock_check_flag_error_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
if (F_status_is_error(status)) {
f_thread_mutex_unlock(&main->thread.lock.cancel);
if (entry->timeout_exit && !(entry->flag & controller_entry_flag_timeout_exit_no_e)) {
f_number_unsigned_t lapsed = 0;
- controller_lock_read(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
+ controller_lock_read(is_normal, controller_lock_check_flag_no_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
for (i = 0; i < main->thread.instances.used && lapsed < entry->timeout_exit; ++i) {
f_thread_unlock(&main->thread.lock.instance);
}
- status = controller_lock_read(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
+ status = controller_lock_read(is_normal, controller_lock_check_flag_error_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.lock.instance);
if (F_status_is_error(status)) {
f_thread_mutex_unlock(&main->thread.lock.cancel);
if (!main->thread.instances.array[i]) continue;
- status = controller_lock_read(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.instances.array[i]->active);
+ status = controller_lock_read(is_normal, controller_lock_check_flag_error_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &main->thread.instances.array[i]->active);
if (F_status_is_error(status)) continue;
instance = main->thread.instances.array[i];
f_signal_send(F_signal_kill, instance->childs.array[j]);
}
- status = controller_lock_write(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &instance->lock);
+ status = controller_lock_write(is_normal, controller_lock_check_flag_error_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &instance->lock);
instance->childs.array[j] = 0;
f_signal_send(F_signal_kill, pid);
}
- status = controller_lock_write(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &instance->lock);
+ status = controller_lock_write(is_normal, controller_lock_check_flag_error_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &instance->lock);
f_file_remove(instance->path_pids.array[j]);
instance->path_pids.array[j].used = 0;
} // for
}
- status = controller_lock_write(is_normal, F_false, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &instance->lock);
+ status = controller_lock_write(is_normal, controller_lock_check_flag_error_d, controller_thread_timeout_cancel_seconds_d, controller_thread_timeout_cancel_nanoseconds_d, &main->thread, &instance->lock);
if (F_status_is_error_not(status)) {