aboutsummaryrefslogtreecommitdiffstats
path: root/include/os/linux/thread.c
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2024-09-25 16:09:09 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2024-09-25 16:09:09 -0400
commitf347fde22f1297e4f022600d201780d5ead78114 (patch)
tree76be305d6187003a1e0486ff6e91efb1062ae118 /include/os/linux/thread.c
parent8340d234d78a7d0f46c11a584de538148b78b7cb (diff)
Delete no-longer-needed nvgpu headersHEADmasterjbakita-wip
The dependency on these was removed in commit 8340d234.
Diffstat (limited to 'include/os/linux/thread.c')
-rw-r--r--include/os/linux/thread.c70
1 files changed, 0 insertions, 70 deletions
diff --git a/include/os/linux/thread.c b/include/os/linux/thread.c
deleted file mode 100644
index c56bff6..0000000
--- a/include/os/linux/thread.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kthread.h>
18
19#include <nvgpu/thread.h>
20#include <nvgpu/timers.h>
21
22int nvgpu_thread_proxy(void *threaddata)
23{
24 struct nvgpu_thread *thread = threaddata;
25 int ret = thread->fn(thread->data);
26
27 thread->running = false;
28 return ret;
29}
30
31int nvgpu_thread_create(struct nvgpu_thread *thread,
32 void *data,
33 int (*threadfn)(void *data), const char *name)
34{
35 struct task_struct *task = kthread_create(nvgpu_thread_proxy,
36 thread, name);
37 if (IS_ERR(task))
38 return PTR_ERR(task);
39
40 thread->task = task;
41 thread->fn = threadfn;
42 thread->data = data;
43 thread->running = true;
44 wake_up_process(task);
45 return 0;
46};
47
48void nvgpu_thread_stop(struct nvgpu_thread *thread)
49{
50 if (thread->task) {
51 kthread_stop(thread->task);
52 thread->task = NULL;
53 }
54};
55
56bool nvgpu_thread_should_stop(struct nvgpu_thread *thread)
57{
58 return kthread_should_stop();
59};
60
61bool nvgpu_thread_is_running(struct nvgpu_thread *thread)
62{
63 return ACCESS_ONCE(thread->running);
64};
65
66void nvgpu_thread_join(struct nvgpu_thread *thread)
67{
68 while (ACCESS_ONCE(thread->running))
69 nvgpu_msleep(10);
70};