Remove type casting to wdentry_t (sched/)
This commit is contained in:
parent
81b286d375
commit
3cc336dddd
@ -64,7 +64,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void nxmq_rcvtimeout(int argc, wdparm_t pid)
|
static void nxmq_rcvtimeout(int argc, wdparm_t pid, ...)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *wtcb;
|
FAR struct tcb_s *wtcb;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
@ -224,8 +224,7 @@ ssize_t nxmq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||||||
|
|
||||||
/* Start the watchdog */
|
/* Start the watchdog */
|
||||||
|
|
||||||
wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_rcvtimeout,
|
wd_start(rtcb->waitdog, ticks, nxmq_rcvtimeout, 1, getpid());
|
||||||
1, getpid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the message from the message queue */
|
/* Get the message from the message queue */
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void nxmq_sndtimeout(int argc, wdparm_t pid)
|
static void nxmq_sndtimeout(int argc, wdparm_t pid, ...)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *wtcb;
|
FAR struct tcb_s *wtcb;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
@ -256,8 +256,7 @@ int nxmq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen,
|
|||||||
|
|
||||||
/* Start the watchdog and begin the wait for MQ not full */
|
/* Start the watchdog and begin the wait for MQ not full */
|
||||||
|
|
||||||
wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_sndtimeout,
|
wd_start(rtcb->waitdog, ticks, nxmq_sndtimeout, 1, getpid());
|
||||||
1, getpid());
|
|
||||||
|
|
||||||
/* And wait for the message queue to be non-empty */
|
/* And wait for the message queue to be non-empty */
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -67,61 +68,73 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void pthread_condtimedout(int argc, uint32_t pid, uint32_t signo)
|
static void pthread_condtimedout(int argc, wdparm_t arg1, ...)
|
||||||
{
|
{
|
||||||
|
pid_t pid = (pid_t)arg1;
|
||||||
|
int signo;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
/* Retrieve the variadic argument */
|
||||||
|
|
||||||
|
va_start(ap, arg1);
|
||||||
|
signo = (int)va_arg(ap, wdparm_t);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
|
|
||||||
FAR struct tcb_s *tcb;
|
|
||||||
siginfo_t info;
|
|
||||||
|
|
||||||
/* The logic below if equivalent to nxsig_queue(), but uses
|
|
||||||
* nxsig_tcbdispatch() instead of nxsig_dispatch(). This avoids the group
|
|
||||||
* signal deliver logic and assures, instead, that the signal is delivered
|
|
||||||
* specifically to this thread that is known to be waiting on the signal.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Get the waiting TCB. sched_gettcb() might return NULL if the task has
|
|
||||||
* exited for some reason.
|
|
||||||
*/
|
|
||||||
|
|
||||||
tcb = sched_gettcb((pid_t)pid);
|
|
||||||
if (tcb)
|
|
||||||
{
|
{
|
||||||
/* Create the siginfo structure */
|
FAR struct tcb_s *tcb;
|
||||||
|
siginfo_t info;
|
||||||
|
|
||||||
info.si_signo = signo;
|
/* The logic below if equivalent to nxsig_queue(), but uses
|
||||||
info.si_code = SI_QUEUE;
|
* nxsig_tcbdispatch() instead of nxsig_dispatch(). This avoids the
|
||||||
info.si_errno = ETIMEDOUT;
|
* group signal deliver logic and assures, instead, that the signal is
|
||||||
info.si_value.sival_ptr = NULL;
|
* delivered specifically to this thread that is known to be waiting on
|
||||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
* the signal.
|
||||||
info.si_pid = (pid_t)pid;
|
|
||||||
info.si_status = OK;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Process the receipt of the signal. The scheduler is not locked as
|
|
||||||
* is normally the case when this function is called because we are in
|
|
||||||
* a watchdog timer interrupt handler.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nxsig_tcbdispatch(tcb, &info);
|
/* Get the waiting TCB. sched_gettcb() might return NULL if the task
|
||||||
|
* has exited for some reason.
|
||||||
|
*/
|
||||||
|
|
||||||
|
tcb = sched_gettcb(pid);
|
||||||
|
if (tcb)
|
||||||
|
{
|
||||||
|
/* Create the siginfo structure */
|
||||||
|
|
||||||
|
info.si_signo = signo;
|
||||||
|
info.si_code = SI_QUEUE;
|
||||||
|
info.si_errno = ETIMEDOUT;
|
||||||
|
info.si_value.sival_ptr = NULL;
|
||||||
|
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||||
|
info.si_pid = pid;
|
||||||
|
info.si_status = OK;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Process the receipt of the signal. The scheduler is not locked
|
||||||
|
* as is normally the case when this function is called because we
|
||||||
|
* are in a watchdog timer interrupt handler.
|
||||||
|
*/
|
||||||
|
|
||||||
|
nxsig_tcbdispatch(tcb, &info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* HAVE_GROUP_MEMBERS */
|
#else /* HAVE_GROUP_MEMBERS */
|
||||||
|
{
|
||||||
/* Things are a little easier if there are not group members. We can just
|
/* Things are a little easier if there are not group members. We can
|
||||||
* use nxsig_queue().
|
* just use nxsig_queue().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||||
union sigval value;
|
union sigval value;
|
||||||
|
|
||||||
/* Send the specified signal to the specified task. */
|
/* Send the specified signal to the specified task. */
|
||||||
|
|
||||||
value.sival_ptr = NULL;
|
value.sival_ptr = NULL;
|
||||||
nxsig_queue((int)pid, (int)signo, value);
|
nxsig_queue((int)pid, signo, value);
|
||||||
#else
|
#else
|
||||||
nxsig_queue((int)pid, (int)signo, NULL);
|
nxsig_queue((int)pid, signo, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAVE_GROUP_MEMBERS */
|
#endif /* HAVE_GROUP_MEMBERS */
|
||||||
}
|
}
|
||||||
@ -276,9 +289,9 @@ int pthread_cond_timedwait(FAR pthread_cond_t *cond,
|
|||||||
/* Start the watchdog */
|
/* Start the watchdog */
|
||||||
|
|
||||||
wd_start(rtcb->waitdog, ticks,
|
wd_start(rtcb->waitdog, ticks,
|
||||||
(wdentry_t)pthread_condtimedout,
|
pthread_condtimedout,
|
||||||
2, (uint32_t)mypid,
|
2, (wdparm_t)mypid,
|
||||||
(uint32_t)SIGCONDTIMEDOUT);
|
(wdparm_t)SIGCONDTIMEDOUT);
|
||||||
|
|
||||||
/* Take the condition semaphore. Do not restore
|
/* Take the condition semaphore. Do not restore
|
||||||
* interrupts until we return from the wait. This is
|
* interrupts until we return from the wait. This is
|
||||||
|
@ -132,8 +132,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
|
|||||||
|
|
||||||
/* Start the watchdog with interrupts still disabled */
|
/* Start the watchdog with interrupts still disabled */
|
||||||
|
|
||||||
wd_start(rtcb->waitdog, delay, (wdentry_t)nxsem_timeout,
|
wd_start(rtcb->waitdog, delay, nxsem_timeout, 1, getpid());
|
||||||
1, getpid());
|
|
||||||
|
|
||||||
/* Now perform the blocking wait */
|
/* Now perform the blocking wait */
|
||||||
|
|
||||||
|
@ -175,8 +175,7 @@ int nxsem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime)
|
|||||||
|
|
||||||
/* Start the watchdog */
|
/* Start the watchdog */
|
||||||
|
|
||||||
wd_start(rtcb->waitdog, ticks, (wdentry_t)nxsem_timeout,
|
wd_start(rtcb->waitdog, ticks, nxsem_timeout, 1, getpid());
|
||||||
1, getpid());
|
|
||||||
|
|
||||||
/* Now perform the blocking wait. If nxsem_wait() fails, the
|
/* Now perform the blocking wait. If nxsem_wait() fails, the
|
||||||
* negated errno value will be returned below.
|
* negated errno value will be returned below.
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void nxsem_timeout(int argc, wdparm_t pid)
|
void nxsem_timeout(int argc, wdparm_t pid, ...)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *wtcb;
|
FAR struct tcb_s *wtcb;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
@ -75,7 +75,7 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode);
|
|||||||
|
|
||||||
/* Handle semaphore timer expiration */
|
/* Handle semaphore timer expiration */
|
||||||
|
|
||||||
void nxsem_timeout(int argc, wdparm_t pid);
|
void nxsem_timeout(int argc, wdparm_t pid, ...);
|
||||||
|
|
||||||
/* Recover semaphore resources with a task or thread is destroyed */
|
/* Recover semaphore resources with a task or thread is destroyed */
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void nxsig_timeout(int argc, wdparm_t itcb)
|
static void nxsig_timeout(int argc, wdparm_t itcb, ...)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
@ -358,7 +358,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
|||||||
/* Start the watchdog */
|
/* Start the watchdog */
|
||||||
|
|
||||||
wd_start(rtcb->waitdog, waitticks,
|
wd_start(rtcb->waitdog, waitticks,
|
||||||
(wdentry_t)nxsig_timeout, 1, wdparm.pvarg);
|
nxsig_timeout, 1, wdparm.pvarg);
|
||||||
|
|
||||||
/* Now wait for either the signal or the watchdog, but
|
/* Now wait for either the signal or the watchdog, but
|
||||||
* first, make sure this is not the idle task,
|
* first, make sure this is not the idle task,
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
static inline void timer_signotify(FAR struct posix_timer_s *timer);
|
static inline void timer_signotify(FAR struct posix_timer_s *timer);
|
||||||
static inline void timer_restart(FAR struct posix_timer_s *timer,
|
static inline void timer_restart(FAR struct posix_timer_s *timer,
|
||||||
wdparm_t itimer);
|
wdparm_t itimer);
|
||||||
static void timer_timeout(int argc, wdparm_t itimer);
|
static void timer_timeout(int argc, wdparm_t itimer, ...);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@ -99,7 +99,7 @@ static inline void timer_restart(FAR struct posix_timer_s *timer,
|
|||||||
{
|
{
|
||||||
timer->pt_last = timer->pt_delay;
|
timer->pt_last = timer->pt_delay;
|
||||||
wd_start(timer->pt_wdog, timer->pt_delay,
|
wd_start(timer->pt_wdog, timer->pt_delay,
|
||||||
(wdentry_t)timer_timeout, 1, itimer);
|
timer_timeout, 1, itimer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ static inline void timer_restart(FAR struct posix_timer_s *timer,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void timer_timeout(int argc, wdparm_t itimer)
|
static void timer_timeout(int argc, wdparm_t itimer, ...)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_CAN_PASS_STRUCTS
|
#ifndef CONFIG_CAN_PASS_STRUCTS
|
||||||
/* On many small machines, pointers are encoded and cannot be simply cast
|
/* On many small machines, pointers are encoded and cannot be simply cast
|
||||||
@ -355,7 +355,7 @@ int timer_settime(timer_t timerid, int flags,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
timer->pt_last = delay;
|
timer->pt_last = delay;
|
||||||
ret = wd_start(timer->pt_wdog, delay, (wdentry_t)timer_timeout,
|
ret = wd_start(timer->pt_wdog, delay, timer_timeout,
|
||||||
1, (wdparm_t)timer);
|
1, (wdparm_t)timer);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user