11
11
#include <linux/completion.h>
12
12
#include <linux/kernel.h>
13
13
#include <linux/kthread.h>
14
+ #include <linux/sched/task.h>
14
15
15
16
#include "try-catch-impl.h"
16
17
@@ -65,14 +66,15 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)
65
66
try_catch -> context = context ;
66
67
try_catch -> try_completion = & try_completion ;
67
68
try_catch -> try_result = 0 ;
68
- task_struct = kthread_run (kunit_generic_run_threadfn_adapter ,
69
- try_catch ,
70
- "kunit_try_catch_thread" );
69
+ task_struct = kthread_create (kunit_generic_run_threadfn_adapter ,
70
+ try_catch , "kunit_try_catch_thread" );
71
71
if (IS_ERR (task_struct )) {
72
72
try_catch -> try_result = PTR_ERR (task_struct );
73
73
try_catch -> catch (try_catch -> context );
74
74
return ;
75
75
}
76
+ get_task_struct (task_struct );
77
+ wake_up_process (task_struct );
76
78
77
79
time_remaining = wait_for_completion_timeout (& try_completion ,
78
80
kunit_test_timeout ());
@@ -82,6 +84,7 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)
82
84
kthread_stop (task_struct );
83
85
}
84
86
87
+ put_task_struct (task_struct );
85
88
exit_code = try_catch -> try_result ;
86
89
87
90
if (!exit_code )
0 commit comments