Skip to content

Commit ceadd57

Browse files
committed
add kthread.h
1 parent 6a461ca commit ceadd57

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

docs/6-api-list.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ Tenok API List
273273

274274
## Kernel-space API
275275

276+
### Kernel Thread
277+
278+
* kthread_create()
279+
276280
### Logging:
277281

278282
* printk()

include/kernel/kernel.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ struct thread_info {
131131
struct list_head list; /* Link to a scheduling list */
132132
};
133133

134-
int kthread_create(task_func_t task_func, uint8_t priority, int stack_size);
135-
136134
struct task_struct *current_task_info(void);
137135
struct thread_info *current_thread_info(void);
138136
struct thread_info *acquire_thread(int tid);

include/kernel/kthread.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @file
3+
*/
4+
#ifndef __KTHREAD_H__
5+
#define __KTHREAD_H__
6+
7+
#include <kernel/task.h>
8+
9+
/**
10+
* @brief Create new kernel task
11+
* @param task_func: Task function to run.
12+
* @param priority: Priority of the task.
13+
* @param stack_size: Stack size of the task.
14+
* @retval int: The function return positive task pid number if
15+
* success; otherwise it returns a negative error
16+
* number.
17+
*/
18+
int kthread_create(task_func_t task_func, uint8_t priority, int stack_size);
19+
20+
#endif

0 commit comments

Comments
 (0)