Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunke120
rt-thread
提交
8e7ed7e1
R
rt-thread
项目概览
yunke120
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8e7ed7e1
编写于
9月 05, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
9月 05, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5012 from Guozhanxin/signal_com
[add] a comment for the signal
上级
93b17bf6
4e4f381f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
0 deletion
+60
-0
src/signal.c
src/signal.c
+60
-0
未找到文件。
src/signal.c
浏览文件 @
8e7ed7e1
...
...
@@ -206,6 +206,20 @@ void *rt_signal_check(void* context)
}
#endif
/* RT_USING_SMP */
/**
* @brief This function will install a processing function to a specific
* signal and return the old processing function of this signal.
*
* @note This function needs to be used in conjunction with the
* rt_signal_unmask() function to make the signal effective.
*
* @see rt_signal_unmask()
*
* @param signo is a specific signal value (range: 0 ~ RT_SIG_MAX).
*
* @return Return the old processing function of this signal. ONLY When the
* return value is SIG_ERR, the operation is failed.
*/
rt_sighandler_t
rt_signal_install
(
int
signo
,
rt_sighandler_t
handler
)
{
rt_base_t
level
;
...
...
@@ -233,6 +247,17 @@ rt_sighandler_t rt_signal_install(int signo, rt_sighandler_t handler)
return
old
;
}
/**
* @brief This function will block the specified signal.
*
* @note This function will block the specified signal, even if the
* rt_thread_kill() function is called to send this signal to
* the current thread, it will no longer take effect.
*
* @see rt_thread_kill()
*
* @param signo is a specific signal value (range: 0 ~ RT_SIG_MAX).
*/
void
rt_signal_mask
(
int
signo
)
{
rt_base_t
level
;
...
...
@@ -245,6 +270,17 @@ void rt_signal_mask(int signo)
rt_hw_interrupt_enable
(
level
);
}
/**
* @brief This function will unblock the specified signal.
*
* @note This function will unblock the specified signal. After calling
* the rt_thread_kill() function to send this signal to the current
* thread, it will take effect.
*
* @see rt_thread_kill()
*
* @param signo is a specific signal value (range: 0 ~ RT_SIG_MAX).
*/
void
rt_signal_unmask
(
int
signo
)
{
rt_base_t
level
;
...
...
@@ -266,6 +302,20 @@ void rt_signal_unmask(int signo)
}
}
/**
* @brief This function will wait for the arrival of the set signal. If it does not wait for this signal, the thread will be
* suspended until it waits for this signal or the waiting time exceeds the specified timeout: timeout.
*
* @param set is the set of signal values to be waited for. Use the function
* sigaddset() to add the signal.
*
* @param si is a pointer to the received signal info. If you don't care about this value, you can use RT_NULL to set.
*
* @param timeout is a timeout period (unit: an OS tick).
*
* @return Return the operation status. When the return value is RT_EOK, the operation is successful.
* If the return value is any other values, it means that the signal wait failed.
*/
int
rt_signal_wait
(
const
rt_sigset_t
*
set
,
rt_siginfo_t
*
si
,
rt_int32_t
timeout
)
{
int
ret
=
RT_EOK
;
...
...
@@ -497,6 +547,16 @@ void rt_thread_free_sig(rt_thread_t tid)
}
}
/**
* @brief This function can be used to send any signal to any thread.
*
* @param tid is a pointer to the thread that receives the signal.
*
* @param sig is a specific signal value (range: 0 ~ RT_SIG_MAX).
*
* @return Return the operation status. When the return value is RT_EOK, the operation is successful.
* If the return value is any other values, it means that the signal send failed.
*/
int
rt_thread_kill
(
rt_thread_t
tid
,
int
sig
)
{
siginfo_t
si
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录