[smart] split out part of lwp_new() to lwp_create()

Prev implementation of lwp_new() including the create of lwp object
and the pid allocation. But not every lwp object need a pid.
So this patch split out the business of lwp_new() to improve the
maintainability.

Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
Shell
2023-09-25 16:12:49 +08:00
committed by guo
parent 261f5bee67
commit a300cef2a8
7 changed files with 49 additions and 56 deletions

View File

@@ -17,11 +17,16 @@
extern "C" {
#endif
#define LWP_CREATE_FLAG_NONE 0x0000
#define LWP_CREATE_FLAG_ALLOC_PID 0x0001 /* allocate pid on lwp object create */
struct rt_lwp;
struct lwp_avl_struct *lwp_get_pid_ary(void);
struct rt_lwp* lwp_new(void);
/* create a lwp object */
struct rt_lwp* lwp_create(rt_base_t flags);
void lwp_free(struct rt_lwp* lwp);
int lwp_ref_inc(struct rt_lwp *lwp);