Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
62d2403e
R
rt-thread
项目概览
2345VOR
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
62d2403e
编写于
4月 28, 2022
作者:
mysterywolf
提交者:
GitHub
4月 29, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kernel] beautify code (#5890)
上级
4a12bc2a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
45 addition
and
47 deletion
+45
-47
include/rtdef.h
include/rtdef.h
+34
-34
src/thread.c
src/thread.c
+11
-13
未找到文件。
include/rtdef.h
浏览文件 @
62d2403e
...
...
@@ -387,7 +387,7 @@ struct rt_object
#ifdef RT_USING_MODULE
void
*
module_id
;
/**< id of application module */
#endif
#endif
/* RT_USING_MODULE */
rt_list_t
list
;
/**< list node of kernel object */
};
typedef
struct
rt_object
*
rt_object_t
;
/**< Type for kernel objects. */
...
...
@@ -450,8 +450,8 @@ struct rt_object_information
#define __ON_HOOK_ARGS(__hook, argv) do {if ((__hook) != RT_NULL) __hook argv; } while (0)
#else
#define __ON_HOOK_ARGS(__hook, argv)
#endif
#endif
#endif
/* RT_HOOK_USING_FUNC_PTR */
#endif
/* RT_USING_HOOK */
#ifndef __on_rt_interrupt_switch_hook
#define __on_rt_interrupt_switch_hook() __ON_HOOK_ARGS(rt_interrupt_switch_hook, ())
...
...
@@ -528,7 +528,7 @@ typedef void (*rt_sighandler_t)(int signo);
typedef
siginfo_t
rt_siginfo_t
;
#define RT_SIG_MAX 32
#endif
#endif
/* RT_USING_SIGNALS */
/**@}*/
/**
...
...
@@ -576,11 +576,11 @@ typedef siginfo_t rt_siginfo_t;
#ifndef RT_SCHEDULE_IPI
#define RT_SCHEDULE_IPI 0
#endif
#endif
/* RT_SCHEDULE_IPI */
#ifndef RT_STOP_IPI
#define RT_STOP_IPI 1
#endif
#endif
/* RT_STOP_IPI */
/**
* CPUs definitions
...
...
@@ -600,12 +600,12 @@ struct rt_cpu
rt_uint8_t
ready_table
[
32
];
#else
rt_uint32_t
priority_group
;
#endif
#endif
/* RT_THREAD_PRIORITY_MAX > 32 */
rt_tick_t
tick
;
};
#endif
#endif
/* RT_USING_SMP */
/**
* Thread structure
...
...
@@ -619,7 +619,7 @@ struct rt_thread
#ifdef RT_USING_MODULE
void
*
module_id
;
/**< id of application module */
#endif
#endif
/* RT_USING_MODULE */
rt_list_t
list
;
/**< the object list */
rt_list_t
tlist
;
/**< the thread list */
...
...
@@ -650,32 +650,32 @@ struct rt_thread
#if RT_THREAD_PRIORITY_MAX > 32
rt_uint8_t
number
;
rt_uint8_t
high_mask
;
#endif
#endif
/* RT_THREAD_PRIORITY_MAX > 32 */
rt_uint32_t
number_mask
;
#if
defined(RT_USING_EVENT)
#if
def RT_USING_EVENT
/* thread event */
rt_uint32_t
event_set
;
rt_uint8_t
event_info
;
#endif
#endif
/* RT_USING_EVENT */
#if
defined(RT_USING_SIGNALS)
#if
def RT_USING_SIGNALS
rt_sigset_t
sig_pending
;
/**< the pending signals */
rt_sigset_t
sig_mask
;
/**< the mask bits of signal */
#ifndef RT_USING_SMP
void
*
sig_ret
;
/**< the return stack pointer from signal */
#endif
#endif
/* RT_USING_SMP */
rt_sighandler_t
*
sig_vectors
;
/**< vectors of signal handler */
void
*
si_list
;
/**< the signal infor list */
#endif
#endif
/* RT_USING_SIGNALS */
rt_ubase_t
init_tick
;
/**< thread's initialized tick */
rt_ubase_t
remaining_tick
;
/**< remaining tick */
#ifdef RT_USING_CPU_USAGE
rt_uint64_t
duration_tick
;
/**< cpu usage tick */
#endif
#endif
/* RT_USING_CPU_USAGE */
struct
rt_timer
thread_timer
;
/**< built-in thread timer */
...
...
@@ -684,7 +684,7 @@ struct rt_thread
/* light weight process if present */
#ifdef RT_USING_LWP
void
*
lwp
;
#endif
#endif
/* RT_USING_LWP */
rt_ubase_t
user_data
;
/**< private user data beyond this thread */
};
...
...
@@ -732,7 +732,7 @@ struct rt_semaphore
rt_uint16_t
reserved
;
/**< reserved field */
};
typedef
struct
rt_semaphore
*
rt_sem_t
;
#endif
#endif
/* RT_USING_SEMAPHORE */
#ifdef RT_USING_MUTEX
/**
...
...
@@ -750,7 +750,7 @@ struct rt_mutex
struct
rt_thread
*
owner
;
/**< current owner of mutex */
};
typedef
struct
rt_mutex
*
rt_mutex_t
;
#endif
#endif
/* RT_USING_MUTEX */
#ifdef RT_USING_EVENT
/**
...
...
@@ -770,7 +770,7 @@ struct rt_event
rt_uint32_t
set
;
/**< event set */
};
typedef
struct
rt_event
*
rt_event_t
;
#endif
#endif
/* RT_USING_EVENT */
#ifdef RT_USING_MAILBOX
/**
...
...
@@ -791,7 +791,7 @@ struct rt_mailbox
rt_list_t
suspend_sender_thread
;
/**< sender thread suspended on this mailbox */
};
typedef
struct
rt_mailbox
*
rt_mailbox_t
;
#endif
#endif
/* RT_USING_MAILBOX */
#ifdef RT_USING_MESSAGEQUEUE
/**
...
...
@@ -815,7 +815,7 @@ struct rt_messagequeue
rt_list_t
suspend_sender_thread
;
/**< sender thread suspended on this message queue */
};
typedef
struct
rt_messagequeue
*
rt_mq_t
;
#endif
#endif
/* RT_USING_MESSAGEQUEUE */
/**@}*/
...
...
@@ -839,7 +839,7 @@ struct rt_memory
rt_size_t
max
;
/**< maximum usage */
};
typedef
struct
rt_memory
*
rt_mem_t
;
#endif
#endif
/* RT_USING_HEAP */
/*
* memory management
...
...
@@ -848,11 +848,11 @@ typedef struct rt_memory *rt_mem_t;
#ifdef RT_USING_SMALL_MEM
typedef
rt_mem_t
rt_smem_t
;
#endif
#endif
/* RT_USING_SMALL_MEM */
#ifdef RT_USING_SLAB
typedef
rt_mem_t
rt_slab_t
;
#endif
#endif
/* RT_USING_SLAB */
#ifdef RT_USING_MEMHEAP
/**
...
...
@@ -870,7 +870,7 @@ struct rt_memheap_item
struct
rt_memheap_item
*
prev_free
;
/**< prev free memheap item */
#ifdef RT_USING_MEMTRACE
rt_uint8_t
owner_thread_name
[
4
];
/**< owner thread name */
#endif
#endif
/* RT_USING_MEMTRACE */
};
/**
...
...
@@ -894,7 +894,7 @@ struct rt_memheap
struct
rt_semaphore
lock
;
/**< semaphore lock */
rt_bool_t
locked
;
/**< External lock mark */
};
#endif
#endif
/* RT_USING_MEMHEAP */
#ifdef RT_USING_MEMPOOL
/**
...
...
@@ -916,7 +916,7 @@ struct rt_mempool
rt_list_t
suspend_thread
;
/**< threads pended on this resource */
};
typedef
struct
rt_mempool
*
rt_mp_t
;
#endif
#endif
/* RT_USING_MEMPOOL */
/**@}*/
...
...
@@ -1036,7 +1036,7 @@ struct rt_device_ops
rt_size_t
(
*
write
)
(
rt_device_t
dev
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
size
);
rt_err_t
(
*
control
)(
rt_device_t
dev
,
int
cmd
,
void
*
args
);
};
#endif
#endif
/* RT_USING_DEVICE_OPS */
/**
* WaitQueue structure
...
...
@@ -1076,12 +1076,12 @@ struct rt_device
rt_size_t
(
*
read
)
(
rt_device_t
dev
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
size
);
rt_size_t
(
*
write
)
(
rt_device_t
dev
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
size
);
rt_err_t
(
*
control
)(
rt_device_t
dev
,
int
cmd
,
void
*
args
);
#endif
#endif
/* RT_USING_DEVICE_OPS */
#ifdef RT_USING_POSIX_DEVIO
const
struct
dfs_file_ops
*
fops
;
struct
rt_wqueue
wait_queue
;
#endif
#endif
/* RT_USING_POSIX_DEVIO */
void
*
user_data
;
/**< device private data */
};
...
...
@@ -1194,7 +1194,7 @@ struct rt_device_graphic_ops
#define rt_graphix_ops(device) ((struct rt_device_graphic_ops *)(device->user_data))
/**@}*/
#endif
#endif
/* RT_USING_DEVICE */
#ifdef __cplusplus
}
...
...
@@ -1211,6 +1211,6 @@ enum TICK_WAIT {
}
#endif
/*
end of
__cplusplus */
#endif
/* __cplusplus */
#endif
#endif
/* __RT_DEF_H__ */
src/thread.c
浏览文件 @
62d2403e
...
...
@@ -85,8 +85,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
{
rt_thread_inited_hook
=
hook
;
}
#endif
/* RT_USING_HOOK */
#endif
/* defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) */
static
void
_thread_exit
(
void
)
{
...
...
@@ -195,7 +194,7 @@ static rt_err_t _thread_init(struct rt_thread *thread,
#ifdef RT_USING_EVENT
thread
->
event_set
=
0
;
thread
->
event_info
=
0
;
#endif
#endif
/* RT_USING_EVENT */
#if RT_THREAD_PRIORITY_MAX > 32
thread
->
number
=
0
;
...
...
@@ -251,12 +250,11 @@ static rt_err_t _thread_init(struct rt_thread *thread,
#ifdef RT_USING_CPU_USAGE
thread
->
duration_tick
=
0
;
#endif
#endif
/* RT_USING_CPU_USAGE */
#ifdef RT_USING_MODULE
thread
->
module_id
=
0
;
#endif
#endif
/* RT_USING_MODULE */
RT_OBJECT_HOOK_CALL
(
rt_thread_inited_hook
,
(
thread
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录