]> Kevux Git Server - controller/commit
Update: Thread locking and signal tweaks.
authorKevin Day <Kevin@kevux.org>
Sun, 3 Aug 2025 04:49:12 +0000 (23:49 -0500)
committerKevin Day <Kevin@kevux.org>
Sun, 3 Aug 2025 05:03:12 +0000 (00:03 -0500)
commit95015165aa68c4712ee1db9bbade957d0839887b
treed3043764fcdfe6f588bb29edc80c85a34454a289
parent934c01eadc5c4c88004455d04d091263b2f6792d
Update: Thread locking and signal tweaks.

The `f_thread_condition_signal_all()` requires obtaining the mutex lock before operating.
Move this logic into a single function call and repeatedly use it to reduce code repetition.
The `controller_lock_signal()` is the function that handles the standard `f_thread_condition_signal_all()` call.

Rename `instance.wait' to `instance.wait_condition` to be more consistent.
Rename`instance.wait_lock` to `instance.wait` to be more consistent.

Add a `controller_lock_mutex()` that operates the same as `controller_lock_read()` but for a mutex lock.
The wait condition signal sender uses the newly added `controller_lock_mutex()`.

Use an inline static function `private_controller_rule_instance_perform_unlock_active()` to reduce some of the repeated `instance.active` unlocks in the function `controller_rule_instance_perform()`.

Change the cleanup thread to only unlock the `instance.lock` and `instance.action` locks when done.
I do have concerns with holding the lock before the `f_thread_join()`.
I will have to review and test this out some more.
15 files changed:
sources/c/program/controller/init/signal.c
sources/c/program/controller/main/common/type/instance.c
sources/c/program/controller/main/common/type/instance.h
sources/c/program/controller/main/instance.c
sources/c/program/controller/main/instance.h
sources/c/program/controller/main/instance/prepare.c
sources/c/program/controller/main/instance/wait.c
sources/c/program/controller/main/lock.c
sources/c/program/controller/main/lock.h
sources/c/program/controller/main/process.c
sources/c/program/controller/main/rule/instance.c
sources/c/program/controller/main/rule/wait.c
sources/c/program/controller/main/thread/cleanup.c
sources/c/program/controller/main/thread/entry.c
sources/c/program/controller/main/thread/signal.c