summaryrefslogtreecommitdiff
path: root/nuttx/sched/mq_timedsend.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-06 15:43:28 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-06 15:43:28 +0000
commitf7b7532a4114b831f5ef66ed992d28e65fb3973f (patch)
tree929ad375fc60be5b08f35b49ff681db96d97b842 /nuttx/sched/mq_timedsend.c
parentd8a1b61690862777b137ec182a0d62dcf4ee8db2 (diff)
downloadpx4-nuttx-f7b7532a4114b831f5ef66ed992d28e65fb3973f.tar.gz
px4-nuttx-f7b7532a4114b831f5ef66ed992d28e65fb3973f.tar.bz2
px4-nuttx-f7b7532a4114b831f5ef66ed992d28e65fb3973f.zip
Changed needed to fix issues with task_restart()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5615 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/mq_timedsend.c')
-rw-r--r--nuttx/sched/mq_timedsend.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/nuttx/sched/mq_timedsend.c b/nuttx/sched/mq_timedsend.c
index d48dd32ce..31de84fc4 100644
--- a/nuttx/sched/mq_timedsend.c
+++ b/nuttx/sched/mq_timedsend.c
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/mq_timedsend.c
*
- * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -182,13 +182,13 @@ static void mq_sndtimeout(int argc, uint32_t pid)
int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
const struct timespec *abstime)
{
- WDOG_ID wdog;
- FAR msgq_t *msgq;
+ FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
+ FAR msgq_t *msgq;
FAR mqmsg_t *mqmsg = NULL;
- irqstate_t saved_state;
- int ret = ERROR;
+ irqstate_t saved_state;
+ int ret = ERROR;
- DEBUGASSERT(up_interrupt_context() == false);
+ DEBUGASSERT(up_interrupt_context() == false && rtcb->waitdog == NULL);
/* Verify the input parameters -- setting errno appropriately
* on any failures to verify.
@@ -214,8 +214,8 @@ int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
* before we enter the following critical section.
*/
- wdog = wd_create();
- if (!wdog)
+ rtcb->waitdog = wd_create();
+ if (!rtcb->waitdog)
{
set_errno(EINVAL);
return ERROR;
@@ -272,7 +272,7 @@ int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
{
/* Start the watchdog */
- wd_start(wdog, ticks, (wdentry_t)mq_sndtimeout, 1, getpid());
+ wd_start(rtcb->waitdog, ticks, (wdentry_t)mq_sndtimeout, 1, getpid());
/* And wait for the message queue to be non-empty */
@@ -282,7 +282,7 @@ int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
* or ETIMEOUT. Cancel the watchdog timer in any event.
*/
- wd_cancel(wdog);
+ wd_cancel(rtcb->waitdog);
}
/* That is the end of the atomic operations */
@@ -313,7 +313,8 @@ int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
}
sched_unlock();
- wd_delete(wdog);
+ wd_delete(rtcb->waitdog);
+ rtcb->waitdog = NULL;
return ret;
}