summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/common/linux/thread.c6
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/thread.h9
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/thread.c b/drivers/gpu/nvgpu/common/linux/thread.c
index d37b2a10..ef783bbe 100644
--- a/drivers/gpu/nvgpu/common/linux/thread.c
+++ b/drivers/gpu/nvgpu/common/linux/thread.c
@@ -34,9 +34,15 @@ int nvgpu_thread_create(struct nvgpu_thread *thread,
34void nvgpu_thread_stop(struct nvgpu_thread *thread) 34void nvgpu_thread_stop(struct nvgpu_thread *thread)
35{ 35{
36 kthread_stop(thread->task); 36 kthread_stop(thread->task);
37 thread->task = NULL;
37}; 38};
38 39
39bool nvgpu_thread_should_stop(struct nvgpu_thread *thread) 40bool nvgpu_thread_should_stop(struct nvgpu_thread *thread)
40{ 41{
41 return kthread_should_stop(); 42 return kthread_should_stop();
42}; 43};
44
45bool nvgpu_thread_is_running(struct nvgpu_thread *thread)
46{
47 return thread->task != NULL;
48};
diff --git a/drivers/gpu/nvgpu/include/nvgpu/thread.h b/drivers/gpu/nvgpu/include/nvgpu/thread.h
index 81dac7ca..1e946119 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/thread.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/thread.h
@@ -59,4 +59,13 @@ void nvgpu_thread_stop(struct nvgpu_thread *thread);
59 */ 59 */
60bool nvgpu_thread_should_stop(struct nvgpu_thread *thread); 60bool nvgpu_thread_should_stop(struct nvgpu_thread *thread);
61 61
62/**
63 * nvgpu_thread_is_running - Query if thread is running
64 *
65 * @thread
66 *
67 * Return true if thread is started.
68 */
69bool nvgpu_thread_is_running(struct nvgpu_thread *thread);
70
62#endif /* __NVGPU_THREAD_H__ */ 71#endif /* __NVGPU_THREAD_H__ */