]> Kevux Git Server - controller/commit
Update: Wrap up changes to locking.
authorKevin Day <Kevin@kevux.org>
Thu, 6 Nov 2025 03:15:33 +0000 (21:15 -0600)
committerKevin Day <Kevin@kevux.org>
Thu, 6 Nov 2025 03:15:33 +0000 (21:15 -0600)
commit73cbd71c2fc88f73d7c146ac6832331b660f6c3c
tree948efde55523d322c78c0194a31e72fba365d556
parent1e71592f255248e3d82a69e54b7c631084a05da6
Update: Wrap up changes to locking.

I am pretty much done with the locking changes.
I might want to do other changes pending additional review, but this is good enough for now.

Fix issue where a write lock is returning `F_lock_read` on error instead of `F_lock_write` on error.

Properly set write lock on child processes when assigning the `process_child_id`.
The `process_child_id` is a pointer to a memory region protected by locks and therefore needs to be write locked protected before changes are made to it.

Fix case where `controller_lock_read_instance()` is being called but its return value is not being checked for `F_interrupt`.
When `F_interrupt` is received in this (`sources/c/program/controller/main/rule/instance.c:152`), then break out of the loop and properly return interrupt status code.

The clean up thread should only try to lock the cancel mutex.
If a cancel is on going, then do not wait.
This should not wait because the clean up thread itself will be removed by the cancel operation.

Make a copy of the instances to operate and loop over the sets.
This reduces how long the instances lock shall be set.
The related instances lock can now also be a read lock rather than a write lock because no changes are to be made on the structure itself.

Ensure that the `controller_thread_instance_cancel()` function should exclusively wait for the lock rather than be interrupt driven.
This ensures that if the clean up thread is operating, then the instance cancel should wait for it to be finished.

Signal the reap condition before attempting to join the clean up thread to ensure that the reap lock is released, if it is held.
sources/c/program/controller/main/rule/execute.c
sources/c/program/controller/main/rule/instance.c
sources/c/program/controller/main/thread/cleanup.c
sources/c/program/controller/main/thread/instance.c