未验证 提交 c33a2150 编写于 作者: H Huang Xilong 提交者: GitHub

[comment][libc] add some comments for functions in posix_signal (#7647)

上级 0f998f6b
...@@ -44,7 +44,6 @@ void (*signal(int sig, void (*func)(int))) (int) ...@@ -44,7 +44,6 @@ void (*signal(int sig, void (*func)(int))) (int)
* *
* @return Returns 0 on success. * @return Returns 0 on success.
*/ */
int sigprocmask (int how, const sigset_t *set, sigset_t *oset) int sigprocmask (int how, const sigset_t *set, sigset_t *oset)
{ {
rt_base_t level; rt_base_t level;
...@@ -90,7 +89,16 @@ int sigpending (sigset_t *set) ...@@ -90,7 +89,16 @@ int sigpending (sigset_t *set)
sigprocmask(SIG_SETMASK, RT_NULL, set); sigprocmask(SIG_SETMASK, RT_NULL, set);
return 0; return 0;
} }
/**
* @brief This function will temporarily replace the signal mask of the calling thread
* with the mask given and then suspends the thread until delivery of an expected signal
* or a signal whose action is to terminate a process.
*
* @param set is a pointer of a sigset_t object that is used to replace the original mask of the calling thread.
*
* @return Returns 0 on success.
* If the return value is any other values, it means that the signal wait failed.
*/
int sigsuspend (const sigset_t *set) int sigsuspend (const sigset_t *set)
{ {
int ret = 0; int ret = 0;
...@@ -125,7 +133,6 @@ int sigsuspend (const sigset_t *set) ...@@ -125,7 +133,6 @@ int sigsuspend (const sigset_t *set)
* *
* @return Returns 0 on success or -1 on failure. * @return Returns 0 on success or -1 on failure.
*/ */
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
{ {
rt_sighandler_t old = RT_NULL; rt_sighandler_t old = RT_NULL;
...@@ -145,7 +152,19 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) ...@@ -145,7 +152,19 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
return 0; return 0;
} }
/**
* @brief This function will suspends execution of the calling thread until one of
* the signals in the given set is pending. If none of the signals specified
* are pending, it will wait for the specified time interval.
*
* @param set is the set of signal values to be waited for.
*
* @param info is a pointer to the received signal info.
*
* @param timeout is a pointer to a timespec structure that specifys the waiting time.
*
* @return Return 0 on success. Otherwise, return -1 and set errno to indicate the error.
*/
int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout) int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
{ {
int ret = 0; int ret = 0;
...@@ -162,7 +181,16 @@ int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ti ...@@ -162,7 +181,16 @@ int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ti
errno = ret; errno = ret;
return -1; return -1;
} }
/**
* @brief This function will suspend execution of the calling thread until one of
* the specified signal becomes pending and return the signal number.
*
* @param set is the set of signal values to be waited for.
*
* @param sig is a pointer to the received signal number.
*
* @return Return 0 on success or -1 on failure.
*/
int sigwait(const sigset_t *set, int *sig) int sigwait(const sigset_t *set, int *sig)
{ {
siginfo_t si; siginfo_t si;
...@@ -172,7 +200,16 @@ int sigwait(const sigset_t *set, int *sig) ...@@ -172,7 +200,16 @@ int sigwait(const sigset_t *set, int *sig)
*sig = si.si_signo; *sig = si.si_signo;
return 0; return 0;
} }
/**
* @brief This function will suspend execution of the calling thread until one of
* the specified signal is pending.
*
* @param set is the set of signal values to be waited for.
*
* @param info is a pointer to the received signal info.
*
* @return Return 0 on success or -1 on failure.
*/
int sigwaitinfo(const sigset_t *set, siginfo_t *info) int sigwaitinfo(const sigset_t *set, siginfo_t *info)
{ {
return sigtimedwait(set, info, NULL); return sigtimedwait(set, info, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册