modified: components/libc/posix/delay/delay.c Added comments for all functions in this file
modified: components/libc/posix/signal/posix_signal.c Add comments to the sigqueue function, although it does not have an internal implementation modified: components/libc/posix/signal/posix_signal.h Added detailed explanation to all members of the rt_signal_value enumeration
This commit is contained in:
parent
7c2353a622
commit
fe512e6411
|
@ -12,36 +12,68 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delays the execution of the current thread for the specified number of milliseconds.
|
||||||
|
*
|
||||||
|
* @param msecs The number of milliseconds to sleep.
|
||||||
|
*/
|
||||||
void msleep(unsigned int msecs)
|
void msleep(unsigned int msecs)
|
||||||
{
|
{
|
||||||
rt_thread_mdelay(msecs);
|
rt_thread_mdelay(msecs);
|
||||||
}
|
}
|
||||||
RTM_EXPORT(msleep);
|
RTM_EXPORT(msleep);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delays the execution of the current thread for the specified number of seconds.
|
||||||
|
*
|
||||||
|
* @param seconds The number of seconds to sleep.
|
||||||
|
*/
|
||||||
void ssleep(unsigned int seconds)
|
void ssleep(unsigned int seconds)
|
||||||
{
|
{
|
||||||
msleep(seconds * 1000);
|
msleep(seconds * 1000);
|
||||||
}
|
}
|
||||||
RTM_EXPORT(ssleep);
|
RTM_EXPORT(ssleep);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delays the execution of the current thread for the specified number of milliseconds.
|
||||||
|
*
|
||||||
|
* @param msecs The number of milliseconds to delay.
|
||||||
|
*/
|
||||||
void mdelay(unsigned long msecs)
|
void mdelay(unsigned long msecs)
|
||||||
{
|
{
|
||||||
rt_hw_us_delay(msecs * 1000);
|
rt_hw_us_delay(msecs * 1000);
|
||||||
}
|
}
|
||||||
RTM_EXPORT(mdelay);
|
RTM_EXPORT(mdelay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delays the execution of the current thread for the specified number of microseconds.
|
||||||
|
*
|
||||||
|
* @param usecs The number of microseconds to delay.
|
||||||
|
*/
|
||||||
void udelay(unsigned long usecs)
|
void udelay(unsigned long usecs)
|
||||||
{
|
{
|
||||||
rt_hw_us_delay(usecs);
|
rt_hw_us_delay(usecs);
|
||||||
}
|
}
|
||||||
RTM_EXPORT(udelay);
|
RTM_EXPORT(udelay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delays the execution of the current thread for approximately one microsecond.
|
||||||
|
*
|
||||||
|
* @param nsecs This parameter is ignored.
|
||||||
|
*/
|
||||||
void ndelay(unsigned long nsecs)
|
void ndelay(unsigned long nsecs)
|
||||||
{
|
{
|
||||||
rt_hw_us_delay(1);
|
rt_hw_us_delay(1);
|
||||||
}
|
}
|
||||||
RTM_EXPORT(ndelay);
|
RTM_EXPORT(ndelay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delays the execution of the current thread for the specified number of seconds.
|
||||||
|
*
|
||||||
|
* @param seconds The number of seconds to sleep.
|
||||||
|
*
|
||||||
|
* @return Returns 0 on success.
|
||||||
|
*/
|
||||||
unsigned int sleep(unsigned int seconds)
|
unsigned int sleep(unsigned int seconds)
|
||||||
{
|
{
|
||||||
if (rt_thread_self() != RT_NULL)
|
if (rt_thread_self() != RT_NULL)
|
||||||
|
@ -61,6 +93,13 @@ unsigned int sleep(unsigned int seconds)
|
||||||
}
|
}
|
||||||
RTM_EXPORT(sleep);
|
RTM_EXPORT(sleep);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delays the execution of the current thread for the specified number of microseconds.
|
||||||
|
*
|
||||||
|
* @param usec The number of microseconds to sleep.
|
||||||
|
*
|
||||||
|
* @return Returns 0 on success.
|
||||||
|
*/
|
||||||
int usleep(useconds_t usec)
|
int usleep(useconds_t usec)
|
||||||
{
|
{
|
||||||
if (rt_thread_self() != RT_NULL)
|
if (rt_thread_self() != RT_NULL)
|
||||||
|
|
|
@ -229,6 +229,16 @@ int raise(int sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
/**
|
||||||
|
* @brief Sends a signal to the caller.
|
||||||
|
*
|
||||||
|
* This function sends the signal specified by @p sig to the caller.
|
||||||
|
*
|
||||||
|
* @param sig The signal to be sent.
|
||||||
|
* This should be one of the standard signal macros such as SIGUSR1, SIGUSR2, etc.
|
||||||
|
*
|
||||||
|
* @return Returns 0 on success. If an error occurs, -1 is returned and errno is set appropriately.
|
||||||
|
*/
|
||||||
int sigqueue (pid_t pid, int signo, const union sigval value)
|
int sigqueue (pid_t pid, int signo, const union sigval value)
|
||||||
{
|
{
|
||||||
/* no support, signal queue */
|
/* no support, signal queue */
|
||||||
|
|
|
@ -18,40 +18,40 @@ extern "C" {
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
|
|
||||||
enum rt_signal_value{
|
enum rt_signal_value{
|
||||||
SIG1 = SIGHUP,
|
SIG1 = SIGHUP, // Hangup detected on controlling terminal or death of controlling process
|
||||||
SIG2 = SIGINT,
|
SIG2 = SIGINT, // Interrupt from keyboard
|
||||||
SIG3 = SIGQUIT,
|
SIG3 = SIGQUIT, // Quit from keyboard
|
||||||
SIG4 = SIGILL,
|
SIG4 = SIGILL, // Illegal instruction
|
||||||
SIG5 = SIGTRAP,
|
SIG5 = SIGTRAP, // Trace trap
|
||||||
SIG6 = SIGABRT,
|
SIG6 = SIGABRT, // Abort signal from abort(3)
|
||||||
SIG7 = SIGEMT,
|
SIG7 = SIGEMT, // Emulator trap
|
||||||
SIG8 = SIGFPE,
|
SIG8 = SIGFPE, // Floating-point exception
|
||||||
SIG9 = SIGKILL,
|
SIG9 = SIGKILL, // Kill signal
|
||||||
SIG10 = SIGBUS,
|
SIG10 = SIGBUS, // Bus error
|
||||||
SIG11 = SIGSEGV,
|
SIG11 = SIGSEGV, // Segmentation fault
|
||||||
SIG12 = SIGSYS,
|
SIG12 = SIGSYS, // Bad system call
|
||||||
SIG13 = SIGPIPE,
|
SIG13 = SIGPIPE, // Broken pipe
|
||||||
SIG14 = SIGALRM,
|
SIG14 = SIGALRM, // Timer signal from alarm(2)
|
||||||
SIG15 = SIGTERM,
|
SIG15 = SIGTERM, // Termination signal
|
||||||
SIG16 = SIGURG,
|
SIG16 = SIGURG, // Urgent condition on socket
|
||||||
SIG17 = SIGSTOP,
|
SIG17 = SIGSTOP, // Stop executing (cannot be caught or ignored)
|
||||||
SIG18 = SIGTSTP,
|
SIG18 = SIGTSTP, // Stop signal from keyboard to suspend execution
|
||||||
SIG19 = SIGCONT,
|
SIG19 = SIGCONT, // Continue if stopped
|
||||||
SIG20 = SIGCHLD,
|
SIG20 = SIGCHLD, // Child status has changed
|
||||||
SIG21 = SIGTTIN,
|
SIG21 = SIGTTIN, // Background read from control terminal attempted by background process
|
||||||
SIG22 = SIGTTOU,
|
SIG22 = SIGTTOU, // Background write to control terminal attempted by background process
|
||||||
SIG23 = SIGPOLL,
|
SIG23 = SIGPOLL, // Pollable event
|
||||||
SIG24 = 24, // SIGXCPU,
|
SIG24 = 24, // SIGXCPU: CPU time limit exceeded
|
||||||
SIG25 = 25, // SIGXFSZ,
|
SIG25 = 25, // SIGXFSZ: File size limit exceeded
|
||||||
SIG26 = 26, // SIGVTALRM,
|
SIG26 = 26, // SIGVTALRM: Virtual timer expired
|
||||||
SIG27 = 27, // SIGPROF,
|
SIG27 = 27, // SIGPROF: Profiling timer expired
|
||||||
SIG28 = SIGWINCH,
|
SIG28 = SIGWINCH,// Window size changed
|
||||||
SIG29 = 29, // SIGLOST,
|
SIG29 = 29, // SIGLOST
|
||||||
SIG30 = SIGUSR1,
|
SIG30 = SIGUSR1, // User-defined signal 1
|
||||||
SIG31 = SIGUSR2,
|
SIG31 = SIGUSR2, // User-defined signal 2
|
||||||
SIGRT_MIN = 27, // SIGRTMIN,
|
SIGRT_MIN = 27, // SIGRTMIN: Minimum real-time signal number
|
||||||
SIGRT_MAX = 31, // SIGRTMAX,
|
SIGRT_MAX = 31, // SIGRTMAX: Maximum real-time signal number
|
||||||
SIGMAX = NSIG,
|
SIGMAX = NSIG // Number of signals (total)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue