@@ -44,7 +44,6 @@ void (*signal(int sig, void (*func)(int))) (int)
4444 *
4545 * @return Returns 0 on success.
4646 */
47-
4847int sigprocmask (int how , const sigset_t * set , sigset_t * oset )
4948{
5049 rt_base_t level ;
@@ -90,7 +89,16 @@ int sigpending (sigset_t *set)
9089 sigprocmask (SIG_SETMASK , RT_NULL , set );
9190 return 0 ;
9291}
93-
92+ /**
93+ * @brief This function will temporarily replace the signal mask of the calling thread
94+ * with the mask given and then suspends the thread until delivery of an expected signal
95+ * or a signal whose action is to terminate a process.
96+ *
97+ * @param set is a pointer of a sigset_t object that is used to replace the original mask of the calling thread.
98+ *
99+ * @return Returns 0 on success.
100+ * If the return value is any other values, it means that the signal wait failed.
101+ */
94102int sigsuspend (const sigset_t * set )
95103{
96104 int ret = 0 ;
@@ -125,7 +133,6 @@ int sigsuspend (const sigset_t *set)
125133 *
126134 * @return Returns 0 on success or -1 on failure.
127135 */
128-
129136int sigaction (int signum , const struct sigaction * act , struct sigaction * oldact )
130137{
131138 rt_sighandler_t old = RT_NULL ;
@@ -145,7 +152,19 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
145152
146153 return 0 ;
147154}
148-
155+ /**
156+ * @brief This function will suspends execution of the calling thread until one of
157+ * the signals in the given set is pending. If none of the signals specified
158+ * are pending, it will wait for the specified time interval.
159+ *
160+ * @param set is the set of signal values to be waited for.
161+ *
162+ * @param info is a pointer to the received signal info.
163+ *
164+ * @param timeout is a pointer to a timespec structure that specifys the waiting time.
165+ *
166+ * @return Return 0 on success. Otherwise, return -1 and set errno to indicate the error.
167+ */
149168int sigtimedwait (const sigset_t * set , siginfo_t * info , const struct timespec * timeout )
150169{
151170 int ret = 0 ;
@@ -162,7 +181,16 @@ int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ti
162181 errno = ret ;
163182 return -1 ;
164183}
165-
184+ /**
185+ * @brief This function will suspend execution of the calling thread until one of
186+ * the specified signal becomes pending and return the signal number.
187+ *
188+ * @param set is the set of signal values to be waited for.
189+ *
190+ * @param sig is a pointer to the received signal number.
191+ *
192+ * @return Return 0 on success or -1 on failure.
193+ */
166194int sigwait (const sigset_t * set , int * sig )
167195{
168196 siginfo_t si ;
@@ -172,7 +200,16 @@ int sigwait(const sigset_t *set, int *sig)
172200 * sig = si .si_signo ;
173201 return 0 ;
174202}
175-
203+ /**
204+ * @brief This function will suspend execution of the calling thread until one of
205+ * the specified signal is pending.
206+ *
207+ * @param set is the set of signal values to be waited for.
208+ *
209+ * @param info is a pointer to the received signal info.
210+ *
211+ * @return Return 0 on success or -1 on failure.
212+ */
176213int sigwaitinfo (const sigset_t * set , siginfo_t * info )
177214{
178215 return sigtimedwait (set , info , NULL );
0 commit comments