]> 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:31:39 +0000 (20:31 -0600)
committerKevin Day <kevin@kevux.org>
Thu, 9 Mar 2023 02:31:39 +0000 (20:31 -0600)
commit386aac8b2b7abd772504dbf6c1d1518cb19fe3e4
tree8642a467441d1b3d72e7d7b233126d4618dedecd
parent0c2609bfc082679d90ca58444897a92ab5806559
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