Merge pull request #350 from mmichal10/dont-stop-notexisting-thread

Don't try to stop non running thread
This commit is contained in:
Robert Baldyga 2020-03-10 17:58:34 +01:00 committed by GitHub
commit 09c585bbcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,6 @@ struct cas_thread_info {
atomic_t kicked; atomic_t kicked;
struct task_struct *thread; struct task_struct *thread;
char name[MAX_THREAD_NAME_SIZE]; char name[MAX_THREAD_NAME_SIZE];
bool running;
}; };
static int _cas_io_queue_thread(void *data) static int _cas_io_queue_thread(void *data)
@ -200,14 +199,12 @@ static void _cas_start_thread(struct cas_thread_info *info)
wake_up_process(info->thread); wake_up_process(info->thread);
wait_for_completion(&info->compl); wait_for_completion(&info->compl);
info->running = true;
printk(KERN_DEBUG "Thread %s started\n", info->name); printk(KERN_DEBUG "Thread %s started\n", info->name);
} }
static void _cas_stop_thread(struct cas_thread_info *info) static void _cas_stop_thread(struct cas_thread_info *info)
{ {
if (info->running && info->thread) { if (info && info->thread) {
reinit_completion(&info->compl); reinit_completion(&info->compl);
atomic_set(&info->stop, 1); atomic_set(&info->stop, 1);
wake_up(&info->wq); wake_up(&info->wq);