]> Kevux Git Server - fll/commit
Bugfix: Multiple cancellations may occur, use mutex lock to prevent.
authorKevin Day <kevin@kevux.org>
Thu, 9 Mar 2023 02:27:46 +0000 (20:27 -0600)
committerKevin Day <kevin@kevux.org>
Thu, 9 Mar 2023 02:27:46 +0000 (20:27 -0600)
commitf6c71b6b6d123594e7fd2544b7c4ec34f97c609f
tree8fce136403e774524ce7e0da9c6b145b80e26640
parent1b5cb3e52ab1ed310dd7e3f720b0208a4c3104c2
Bugfix: Multiple cancellations may occur, use mutex lock to prevent.

There is an existing check that prevents the cancellation from being called more than once.
What is not being considered is that if the main thread calls cancellation while another cancellation is active then the controller_thread_process_exit() gets called.
The controller_thread_process_exit() function will begin more forcibly shutting things down.

Avoid this by providing a mutex lock to lock the cancellation.
Only once the first cancellation is complete will the second (or more) then return without doing anything.
level_3/controller/c/common/private-lock.c
level_3/controller/c/common/private-lock.h
level_3/controller/c/lock/private-lock.c
level_3/controller/c/thread/private-thread_process.c