FMT zombie

* fix potential thread zombie if FMT modem shut down
    during a log write
  * added Mike to list of developers in About dialog
This commit is contained in:
Michael Black 2023-11-30 09:28:48 -06:00 committed by dave-w1hkj
parent 36cb5d050f
commit 4a97c10166
3 changed files with 4 additions and 2 deletions

View file

@ -47,6 +47,7 @@ There is NO WARRANTY, to the extent permitted by law.\n\
<H4>Programmers:</H4>\n\
<pre>\
Dave Freese W1HKJ\n\
Mike Black W9MDB\n\
Stelios Bounanos M0GLD\n\
Rem\355 Chateauneu F4ECW\n\
John Douyere VK2ETA\n\

View file

@ -552,6 +552,7 @@ void fmt_write_file()
void *FMT_loop(void *args)
{
SET_THREAD_ID(FMT_TID);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
while(1) {
MilliSleep(50);
if (FMT_exit) break;

View file

@ -130,12 +130,12 @@ bool thread_in_list(int id, const int* list);
pthread_sigmask(SIG_UNBLOCK, &usr2, NULL); \
} while (0)
# define TEST_THREAD_CANCEL() /* nothing */
# define CANCEL_THREAD(t__) pthread_kill(t__, SIGUSR2)
# define CANCEL_THREAD(t__) pthread_kill(t__, SIGUSR2);pthread_join(t__, NULL);
#else
// threads have PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DEFERRED when created
# define SET_THREAD_CANCEL() /* nothing */
# define TEST_THREAD_CANCEL() pthread_testcancel()
# define CANCEL_THREAD(t__) pthread_cancel(t__);
# define CANCEL_THREAD(t__) pthread_cancel(t__);pthread_join(t__, NULL)
#endif
/// This ensures that a mutex is always unlocked when leaving a function or block.