mirror of
https://github.com/apache/nuttx.git
synced 2026-09-12 05:30:20 +00:00
sleep: optimize sleep logic, to reduce the disable IRQ time
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
42041a428c
commit
fc73dfd368
3 changed files with 206 additions and 257 deletions
|
|
@ -439,6 +439,55 @@ int nxsig_kill(pid_t pid, int signo);
|
|||
|
||||
#define nxsig_waitinfo(s,i) nxsig_timedwait(s,i,NULL)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsig_clockwait
|
||||
*
|
||||
* Description:
|
||||
* This function selects the pending signal set specified by the argument
|
||||
* set. If multiple signals are pending in set, it will remove and return
|
||||
* the lowest numbered one. If no signals in set are pending at the time
|
||||
* of the call, the calling process will be suspended until one of the
|
||||
* signals in set becomes pending, OR until the process is interrupted by
|
||||
* an unblocked signal, OR until the time interval specified by timeout
|
||||
* (if any), has expired. If timeout is NULL, then the timeout interval
|
||||
* is forever.
|
||||
*
|
||||
* If the info argument is non-NULL, the selected signal number is stored
|
||||
* in the si_signo member and the cause of the signal is stored in the
|
||||
* si_code member. The content of si_value is only meaningful if the
|
||||
* signal was generated by sigqueue() (or nxsig_queue).
|
||||
*
|
||||
* This is an internal OS interface. It is functionally equivalent to
|
||||
* sigtimedwait() except that:
|
||||
*
|
||||
* - It is not a cancellation point, and
|
||||
* - It does not modify the errno value.
|
||||
*
|
||||
* Input Parameters:
|
||||
* clockid - The ID of the clock to be used to measure the timeout.
|
||||
* flags - Open flags. TIMER_ABSTIME is the only supported flag.
|
||||
* rqtp - The amount of time to be suspended from execution.
|
||||
* rmtp - If the rmtp argument is non-NULL, the timespec structure
|
||||
* referenced by it is updated to contain the amount of time
|
||||
* remaining in the interval (the requested time minus the time
|
||||
* actually slept)
|
||||
*
|
||||
* Returned Value:
|
||||
* This is an internal OS interface and should not be used by applications.
|
||||
* A negated errno value is returned on failure.
|
||||
*
|
||||
* EAGAIN - wait time is zero.
|
||||
* EINTR - The wait was interrupted by an unblocked, caught signal.
|
||||
*
|
||||
* Notes:
|
||||
* This function should be called with critical section set.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nxsig_clockwait(int clockid, int flags,
|
||||
FAR const struct timespec *rqtp,
|
||||
FAR struct timespec *rmtp);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsig_timedwait
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue