Skip to contentSkip to conversation

apply absolute xntimer_start

RFC PATCH In review Jan Kiszka 1 participant 1 message Aug 3, 2006

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

RFC PATCH 2/4 apply absolute xntimer_start

This second patch extends xnpod_suspend_thread and xnsynch_sleep_on by a timeout mode parameter to specify both relative and absolute timeouts on thread suspension.

All callers of the involved services are at least adapted to the interface change. Most callers that formerly converted absolute to relative timeouts now no longer do this - except for the POSIX skin which requires more refactoring.

I'm now scratching my head, because there was something more I wanted to remark here. But I forgot to write it down when I hacked the patch, damn.

Anyway, the patch is tested lightly and seems to include only well hidden regressions. What remains to be done is an evaluation of what we may gain (speed for some scenarios) vs. what we may loose (speed in some other scenarios, code size).

Jan

---
 include/nucleus/pod.h             |    5 ++-
 include/nucleus/synch.h           |    3 --
 ksrc/drivers/testing/switchtest.c |    4 +-
 ksrc/nucleus/pipe.c               |    3 +-
 ksrc/nucleus/pod.c                |   45 +++++++++++++++++++-----------
 ksrc/nucleus/registry.c           |    6 ++--
 ksrc/nucleus/shadow.c             |   13 +++++++-
 ksrc/nucleus/synch.c              |   24 ++++++++++------
 ksrc/skins/native/cond.c          |    2 -
 ksrc/skins/native/event.c         |    2 -
 ksrc/skins/native/heap.c          |    2 -
 ksrc/skins/native/mutex.c         |    2 -
 ksrc/skins/native/queue.c         |    2 -
 ksrc/skins/native/sem.c           |    2 -
 ksrc/skins/native/syscall.c       |    4 +-
 ksrc/skins/native/task.c          |   18 +++++-------
 ksrc/skins/posix/clock.c          |    3 +-
 ksrc/skins/posix/cond.c           |    2 -
 ksrc/skins/posix/mq.c             |    4 +-
 ksrc/skins/posix/mutex.c          |    2 -
 ksrc/skins/posix/mutex.h          |    2 -
 ksrc/skins/posix/registry.c       |    3 +-
 ksrc/skins/posix/sem.c            |    2 -
 ksrc/skins/posix/signal.c         |    3 +-
 ksrc/skins/posix/syscall.c        |    2 -
 ksrc/skins/posix/thread.c         |    3 +-
 ksrc/skins/psos+/event.c          |    2 -
 ksrc/skins/psos+/queue.c          |    2 -
 ksrc/skins/psos+/rn.c             |    2 -
 ksrc/skins/psos+/sem.c            |    2 -
 ksrc/skins/psos+/task.c           |    3 +-
 ksrc/skins/rtdm/drvlib.c          |   56 +++++++++++---------------------------
 ksrc/skins/uitron/flag.c          |    2 -
 ksrc/skins/uitron/mbx.c           |    2 -
 ksrc/skins/uitron/sem.c           |    2 -
 ksrc/skins/uitron/task.c          |   15 ++++++----
 ksrc/skins/vrtx/event.c           |    2 -
 ksrc/skins/vrtx/mb.c              |    2 -
 ksrc/skins/vrtx/mx.c              |    2 -
 ksrc/skins/vrtx/queue.c           |    2 -
 ksrc/skins/vrtx/sem.c             |    2 -
 ksrc/skins/vrtx/task.c            |    6 ++--
 ksrc/skins/vxworks/msgQLib.c      |    6 ++--
 ksrc/skins/vxworks/semLib.c       |    4 +-
 ksrc/skins/vxworks/syscall.c      |    2 -
 ksrc/skins/vxworks/taskLib.c      |    6 ++--
 46 files changed, 152 insertions(+), 133 deletions(-)
include/nucleus/pod.h +3 -2
Index: xenomai/include/nucleus/pod.h
===================================================================
@@ -454,6 +454,7 @@ xnflags_t xnpod_set_thread_mode(xnthread
 void xnpod_suspend_thread(xnthread_t *thread,
                           xnflags_t mask,
                           xnticks_t timeout,
+                          int timeout_mode,
                           struct xnsynch *resource);
 
 void xnpod_resume_thread(xnthread_t *thread,
@@ -536,12 +537,12 @@ static inline void xnpod_yield (void)
 
 static inline void xnpod_delay (xnticks_t timeout)
 {
-    xnpod_suspend_thread(xnpod_current_thread(),XNDELAY,timeout,NULL);
+    xnpod_suspend_thread(xnpod_current_thread(),XNDELAY,timeout,XNTIMER_RELATIVE,NULL);
 }
 
 static inline void xnpod_suspend_self (void)
 {
-    xnpod_suspend_thread(xnpod_current_thread(),XNSUSP,XN_INFINITE,NULL);
+    xnpod_suspend_thread(xnpod_current_thread(),XNSUSP,XN_INFINITE,XNTIMER_RELATIVE,NULL);
 }
 
 static inline void xnpod_delete_self (void)
include/nucleus/synch.h +1 -2
Index: xenomai/include/nucleus/synch.h
===================================================================
@@ -100,8 +100,7 @@ static inline void xnsynch_register_clea
     synch->cleanup = handler;
 }
 
-void xnsynch_sleep_on(xnsynch_t *synch,
-		      xnticks_t timeout);
+void xnsynch_sleep_on(xnsynch_t *synch, xnticks_t timeout, int timeout_mode);
 
 struct xnthread *xnsynch_wakeup_one_sleeper(xnsynch_t *synch);
 
ksrc/drivers/testing/switchtest.c +2 -2
Index: xenomai/ksrc/drivers/testing/switchtest.c
===================================================================
@@ -50,7 +50,7 @@ static int rtswitch_pend_rt(rtswitch_con
 	task = &ctx->tasks[idx];
 	task->base.flags |= RTSWITCH_RT;
 
-	xnsynch_sleep_on(&task->rt_synch, XN_INFINITE);
+	xnsynch_sleep_on(&task->rt_synch, XN_INFINITE, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(xnpod_current_thread(), XNBREAK))
 		return -EINTR;
@@ -99,7 +99,7 @@ static int rtswitch_to_rt(rtswitch_conte
 		return -EINVAL;
 	}
 
-	xnsynch_sleep_on(&from->rt_synch, XN_INFINITE);
+	xnsynch_sleep_on(&from->rt_synch, XN_INFINITE, XNTIMER_RELATIVE);
 
 	xnlock_put_irqrestore(&nklock, s);
 
ksrc/nucleus/pipe.c +2 -1
Index: xenomai/ksrc/nucleus/pipe.c
===================================================================
@@ -432,7 +432,8 @@ ssize_t xnpipe_recv(int minor, struct xn
 			goto unlock_and_exit;
 		}
 
-		xnsynch_sleep_on(&state->synchbase, timeout);
+		xnsynch_sleep_on(&state->synchbase, timeout,
+				 XNTIMER_RELATIVE);
 
 		thread = xnpod_current_thread();
 
ksrc/nucleus/pod.c +28 -17

109 lines not on this page · raw message

ksrc/nucleus/registry.c +4 -2
Index: xenomai/ksrc/nucleus/registry.c
===================================================================
@@ -727,7 +727,8 @@ int xnregistry_bind(const char *key, xnt
 
 		thread = xnpod_current_thread();
 		thread->registry.waitkey = key;
-		xnsynch_sleep_on(&registry_hash_synch, timeout);
+		xnsynch_sleep_on(&registry_hash_synch, timeout,
+				 XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(thread, XNTIMEO)) {
 			err = -ETIMEDOUT;
@@ -915,7 +916,8 @@ int xnregistry_remove_safe(xnhandle_t ha
 	cstamp = object->cstamp;
 
 	do {
-		xnsynch_sleep_on(&object->safesynch, timeout);
+		xnsynch_sleep_on(&object->safesynch, timeout,
+				 XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(xnpod_current_thread(), XNBREAK)) {
 			err = -EINTR;
ksrc/nucleus/shadow.c +11 -2
Index: xenomai/ksrc/nucleus/shadow.c
===================================================================
@@ -719,7 +719,8 @@ void xnshadow_relax(int notify)
 		xnpod_renice_root(XNPOD_ROOT_PRIO_BASE);
 #endif /* CONFIG_XENO_OPT_RPIDISABLE */
 
-	xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE, NULL);
+	xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE,
+			     XNTIMER_RELATIVE, NULL);
 
 	splexit(s);
 
@@ -845,7 +846,8 @@ int xnshadow_map(xnthread_t *thread, xnc
 	    MAX_RT_PRIO ? xnthread_base_priority(thread) : MAX_RT_PRIO - 1;
 	set_linux_task_priority(current, prio);
 	xnshadow_thrptd(current) = thread;
-	xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE, NULL);
+	xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE,
+			     XNTIMER_RELATIVE, NULL);
 
 	if (u_completion) {
 		xnshadow_signal_completion(u_completion, 0);
@@ -1026,6 +1028,13 @@ static int xnshadow_sys_migrate(struct t
 			if (testbits(xnshadow_thread(curr)->status, XNDORMANT))
 				return 0;
 
+			/* Paranoid: a corner case where the
+			   user-space side fiddles with SIGCHLD while
+			   the target thread is still waiting to be
+			   started. */
+			if (testbits(xnshadow_thread(curr)->status, XNDORMANT))
+				return 0;
+
 			return xnshadow_harden()? : 1;
 		} else
 			return 0;
ksrc/nucleus/synch.c +15 -9
Index: xenomai/ksrc/nucleus/synch.c
===================================================================
@@ -127,7 +127,7 @@ static inline void xnsynch_renice_thread
 }
 
 /*! 
- * \fn void xnsynch_sleep_on(xnsynch_t *synch,xnticks_t timeout)
+ * \fn void xnsynch_sleep_on(xnsynch_t *synch,xnticks_t timeout,int timeout_mode)
  * \brief Sleep on a synchronization object.
  *
  * Makes the calling thread sleep on the specified synchronization
@@ -140,9 +140,14 @@ static inline void xnsynch_renice_thread
  * to sleep on.
  *
  * @param timeout The timeout which may be used to limit the time the
- * thread pends on the resource. This value is a count of ticks (see
- * note).  Passing XN_INFINITE specifies an unbounded wait. All other
- * values are used to initialize a nucleus watchdog timer.
+ * thread pends on the resource. This value is a wait time given in
+ * ticks (see note). It can either be relative or absolute dependent on
+ * @a timeout_mode. Passing XN_INFINITE @b and setting @a timeout_mode
+ * to XNTIMER_RELATIVE specifies an unbounded wait. All other values are
+ * used to initialize a watchdog timer.
+ *
+ * @param timeout_mode The mode of the @a timeout parameter. It can either
+ * be set to XNTIMER_RELATIVE or XNTIMER_ABSOLUTE.
  *
  * Environments:
  *
@@ -160,7 +165,7 @@ static inline void xnsynch_renice_thread
  * oneshot mode, clock ticks are interpreted as nanoseconds.
  */
 
-void xnsynch_sleep_on(xnsynch_t *synch, xnticks_t timeout)
+void xnsynch_sleep_on(xnsynch_t *synch, xnticks_t timeout, int timeout_mode)
 {
 	xnthread_t *thread = xnpod_current_thread(), *owner;
 	spl_t s;
@@ -207,13 +212,14 @@ void xnsynch_sleep_on(xnsynch_t *synch, 
 				insertpqf(&synch->pendq, &thread->plink,
 					  thread->cprio);
 
-			xnpod_suspend_thread(thread, XNPEND, timeout, synch);
+			xnpod_suspend_thread(thread, XNPEND, timeout,
+					     timeout_mode, synch);
 
 			if (unlikely(synch->owner != thread)) {
 				/* Somebody stole us the ownership while we were ready to
 				   run, waiting for the CPU: we need to wait again for the
 				   resource. */
-				if (timeout == XN_INFINITE)
+				if (timeout == XN_INFINITE || timeout_mode == XNTIMER_ABSOLUTE)
 					goto redo;
 				timeout = xnthread_timeout(thread);
 				if (timeout > 1)	/* Otherwise, it's too late, time elapsed. */
@@ -223,11 +229,11 @@ void xnsynch_sleep_on(xnsynch_t *synch, 
 			}
 		} else {
 			insertpqf(&synch->pendq, &thread->plink, thread->cprio);
-			xnpod_suspend_thread(thread, XNPEND, timeout, synch);
+			xnpod_suspend_thread(thread, XNPEND, timeout, timeout_mode, synch);
 		}
 	} else {		/* otherwise FIFO */
 		appendpq(&synch->pendq, &thread->plink);
-		xnpod_suspend_thread(thread, XNPEND, timeout, synch);
+		xnpod_suspend_thread(thread, XNPEND, timeout, timeout_mode, synch);
 	}
 
       grab_ownership:
ksrc/skins/native/cond.c +1 -1
Index: xenomai/ksrc/skins/native/cond.c
===================================================================
@@ -452,7 +452,7 @@ int rt_cond_wait(RT_COND *cond, RT_MUTEX
 
 	task = xeno_current_task();
 
-	xnsynch_sleep_on(&cond->synch_base, timeout);
+	xnsynch_sleep_on(&cond->synch_base, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&task->thread_base, XNRMID))
 		err = -EIDRM;	/* Condvar deleted while pending. */
ksrc/skins/native/event.c +1 -1
Index: xenomai/ksrc/skins/native/event.c
===================================================================
@@ -495,7 +495,7 @@ int rt_event_wait(RT_EVENT *event,
 	task = xeno_current_task();
 	task->wait_args.event.mode = mode;
 	task->wait_args.event.mask = mask;
-	xnsynch_sleep_on(&event->synch_base, timeout);
+	xnsynch_sleep_on(&event->synch_base, timeout, XNTIMER_RELATIVE);
 	/* The returned mask is only significant if the operation has
 	   succeeded, but do always write it back anyway. */
 	*mask_r = task->wait_args.event.mask;
ksrc/skins/native/heap.c +1 -1
Index: xenomai/ksrc/skins/native/heap.c
===================================================================
@@ -543,7 +543,7 @@ int rt_heap_alloc(RT_HEAP *heap, size_t 
 	task = xeno_current_task();
 	task->wait_args.heap.size = size;
 	task->wait_args.heap.block = NULL;
-	xnsynch_sleep_on(&heap->synch_base, timeout);
+	xnsynch_sleep_on(&heap->synch_base, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&task->thread_base, XNRMID))
 		err = -EIDRM;	/* Heap deleted while pending. */
ksrc/skins/native/mutex.c +1 -1
Index: xenomai/ksrc/skins/native/mutex.c
===================================================================
@@ -375,7 +375,7 @@ int rt_mutex_lock(RT_MUTEX *mutex, RTIME
 		goto unlock_and_exit;
 	}
 
-	xnsynch_sleep_on(&mutex->synch_base, timeout);
+	xnsynch_sleep_on(&mutex->synch_base, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&task->thread_base, XNRMID))
 		err = -EIDRM;	/* Mutex deleted while pending. */
ksrc/skins/native/queue.c +1 -1
Index: xenomai/ksrc/skins/native/queue.c
===================================================================
@@ -813,7 +813,7 @@ ssize_t rt_queue_receive(RT_QUEUE *q, vo
 			goto unlock_and_exit;
 		}
 
-		xnsynch_sleep_on(&q->synch_base, timeout);
+		xnsynch_sleep_on(&q->synch_base, timeout, XNTIMER_RELATIVE);
 
 		task = xeno_current_task();
 
ksrc/skins/native/sem.c +1 -1
Index: xenomai/ksrc/skins/native/sem.c
===================================================================
@@ -377,7 +377,7 @@ int rt_sem_p(RT_SEM *sem, RTIME timeout)
 	else {
 		RT_TASK *task = xeno_current_task();
 
-		xnsynch_sleep_on(&sem->synch_base, timeout);
+		xnsynch_sleep_on(&sem->synch_base, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&task->thread_base, XNRMID))
 			err = -EIDRM;	/* Semaphore deleted while pending. */
ksrc/skins/native/syscall.c +2 -2
Index: xenomai/ksrc/skins/native/syscall.c
===================================================================
@@ -2976,7 +2976,7 @@ static int __rt_alarm_wait(struct task_s
 		/* Renice the waiter above all regular tasks if needed. */
 		xnpod_renice_thread(&task->thread_base, XNCORE_IRQ_PRIO);
 
-	xnsynch_sleep_on(&alarm->synch_base, XN_INFINITE);
+	xnsynch_sleep_on(&alarm->synch_base, XN_INFINITE, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&task->thread_base, XNRMID))
 		err = -EIDRM;	/* Alarm deleted while pending. */
@@ -3219,7 +3219,7 @@ static int __rt_intr_wait(struct task_st
 			xnpod_renice_thread(&task->thread_base,
 					    XNCORE_IRQ_PRIO);
 
-		xnsynch_sleep_on(&intr->synch_base, timeout);
+		xnsynch_sleep_on(&intr->synch_base, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&task->thread_base, XNRMID))
 			err = -EIDRM;	/* Interrupt object deleted while pending. */
ksrc/skins/native/task.c +8 -10
Index: xenomai/ksrc/skins/native/task.c
===================================================================
@@ -111,7 +111,8 @@ int __native_task_safewait(RT_TASK *task
 	cstamp = task->cstamp;
 
 	do {
-		xnsynch_sleep_on(&task->safesynch, TM_INFINITE);
+		xnsynch_sleep_on(&task->safesynch, TM_INFINITE,
+				 XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags
 		    (&xeno_current_task()->thread_base, XNBREAK))
@@ -439,7 +440,7 @@ int rt_task_suspend(RT_TASK *task)
 
 	if (task->suspend_depth++ == 0)
 		xnpod_suspend_thread(&task->thread_base, XNSUSP, XN_INFINITE,
-				     NULL);
+				     XNTIMER_RELATIVE, NULL);
       unlock_and_exit:
 
 	xnlock_put_irqrestore(&nklock, s);
@@ -932,7 +933,7 @@ int rt_task_sleep(RTIME delay)
 	   implicitely calls the rescheduling procedure. */
 
 	xnpod_suspend_thread(&xeno_current_task()->thread_base,
-			     XNDELAY, delay, NULL);
+			     XNDELAY, delay, XNTIMER_RELATIVE, NULL);
 
 	return xnthread_test_flags(&xeno_current_task()->thread_base,
 				   XNBREAK) ? -EINTR : 0;
@@ -981,7 +982,6 @@ int rt_task_sleep(RTIME delay)
 int rt_task_sleep_until(RTIME date)
 {
 	int err = 0;
-	SRTIME delay;
 	spl_t s;
 
 	if (xnpod_unblockable_p())
@@ -995,11 +995,9 @@ int rt_task_sleep_until(RTIME date)
 	/* Calling the suspension service on behalf of the current task
 	   implicitely calls the rescheduling procedure. */
 
-	delay = date - xnpod_get_time();
-
-	if (delay > 0) {
+	if (date > xnpod_get_time()) {
 		xnpod_suspend_thread(&xeno_current_task()->thread_base,
-				     XNDELAY, delay, NULL);
+				     XNDELAY, date, XNTIMER_ABSOLUTE, NULL);
 
 		if (xnthread_test_flags
 		    (&xeno_current_task()->thread_base, XNBREAK))
@@ -1764,7 +1762,7 @@ ssize_t rt_task_send(RT_TASK *task,
 	   required by the priority inheritance protocol
 	   (i.e. prio(sender) > prio(receiver)). */
 
-	xnsynch_sleep_on(&task->msendq, timeout);
+	xnsynch_sleep_on(&task->msendq, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&sender->thread_base, XNRMID))
 		err = -EIDRM;	/* Receiver deleted while pending. */
@@ -1924,7 +1922,7 @@ int rt_task_receive(RT_TASK_MCB *mcb_r, 
 	/* Wait on our receive slot for some sender to enqueue itself in
 	   our send queue. */
 
-	xnsynch_sleep_on(&receiver->mrecv, timeout);
+	xnsynch_sleep_on(&receiver->mrecv, timeout, XNTIMER_RELATIVE);
 
 	/* XNRMID cannot happen, since well, the current task would be the
 	   deleted object, so... */
ksrc/skins/posix/clock.c +2 -1
Index: xenomai/ksrc/skins/posix/clock.c
===================================================================
@@ -246,7 +246,8 @@ int clock_nanosleep(clockid_t clock_id,
 
 	thread_cancellation_point(cur);
 
-	xnpod_suspend_thread(cur, XNDELAY, timeout + 1, NULL);
+	xnpod_suspend_thread(cur, XNDELAY, timeout + 1,
+			     XNTIMER_RELATIVE, NULL);
 
 	thread_cancellation_point(cur);
 
ksrc/skins/posix/cond.c +1 -1
Index: xenomai/ksrc/skins/posix/cond.c
===================================================================
@@ -289,7 +289,7 @@ int pse51_cond_timedwait_internal(struct
 	}
 
 	/* Wait for another thread to signal the condition. */
-	xnsynch_sleep_on(&cond->synchbase, to);
+	xnsynch_sleep_on(&cond->synchbase, to, XNTIMER_RELATIVE);
 
 	/* There are four possible wakeup conditions :
 	   - cond_signal / cond_broadcast, no status bit is set, and the function
ksrc/skins/posix/mq.c +2 -2
Index: xenomai/ksrc/skins/posix/mq.c
===================================================================
@@ -581,7 +581,7 @@ static int pse51_mq_timedsend_inner(mqd_
 
 		thread_cancellation_point(cur);
 
-		xnsynch_sleep_on(&mq->senders, to);
+		xnsynch_sleep_on(&mq->senders, to, XNTIMER_RELATIVE);
 
 		thread_cancellation_point(cur);
 
@@ -643,7 +643,7 @@ static int pse51_mq_timedrcv_inner(mqd_t
 
 		thread_cancellation_point(cur);
 
-		xnsynch_sleep_on(&mq->receivers, to);
+		xnsynch_sleep_on(&mq->receivers, to, XNTIMER_RELATIVE);
 
 		thread_cancellation_point(cur);
 
ksrc/skins/posix/mutex.c +1 -1
Index: xenomai/ksrc/skins/posix/mutex.c
===================================================================
@@ -214,7 +214,7 @@ int pse51_mutex_timedlock_break(struct _
 				if (err)
 					break;
 
-				xnsynch_sleep_on(&mutex->synchbase, to);
+				xnsynch_sleep_on(&mutex->synchbase, to, XNTIMER_RELATIVE);
 
 				if (xnthread_test_flags(cur, XNBREAK)) {
 					err = EINTR;
ksrc/skins/posix/mutex.h +1 -1
Index: xenomai/ksrc/skins/posix/mutex.h
===================================================================
@@ -87,7 +87,7 @@ static inline int mutex_timedlock_intern
             if (err)
                 return err;
             
-            xnsynch_sleep_on(&mutex->synchbase, to);
+            xnsynch_sleep_on(&mutex->synchbase, to, XNTIMER_RELATIVE);
             
             if (xnthread_test_flags(cur, XNBREAK))
                 return EINTR;
ksrc/skins/posix/registry.c +2 -1
Index: xenomai/ksrc/skins/posix/registry.c
===================================================================
@@ -179,7 +179,8 @@ int pse51_node_get(pse51_node_t ** nodep
 				return EPERM;
 			}
 
-			xnsynch_sleep_on(node->completion_synch, XN_INFINITE);
+			xnsynch_sleep_on(node->completion_synch, XN_INFINITE,
+					 XNTIMER_RELATIVE);
 
 			cur = xnpod_current_thread();
 
ksrc/skins/posix/sem.c +1 -1
Index: xenomai/ksrc/skins/posix/sem.c
===================================================================
@@ -537,7 +537,7 @@ static inline int sem_timedwait_internal
 
 	thread_cancellation_point(cur);
 
-	xnsynch_sleep_on(&sem->synchbase, to);
+	xnsynch_sleep_on(&sem->synchbase, to, XNTIMER_RELATIVE);
 
 	/* Handle cancellation requests. */
 	thread_cancellation_point(cur);
ksrc/skins/posix/signal.c +2 -1
Index: xenomai/ksrc/skins/posix/signal.c
===================================================================
@@ -835,7 +835,8 @@ static int pse51_sigtimedwait_inner(cons
 
 		thread_cancellation_point(&thread->threadbase);
 
-		xnpod_suspend_thread(&thread->threadbase, XNDELAY, to, NULL);
+		xnpod_suspend_thread(&thread->threadbase, XNDELAY, to,
+				     XNTIMER_RELATIVE, NULL);
 
 		thread_cancellation_point(&thread->threadbase);
 
ksrc/skins/posix/syscall.c +1 -1
Index: xenomai/ksrc/skins/posix/syscall.c
===================================================================
@@ -2137,7 +2137,7 @@ static int __intr_wait(struct task_struc
 			/* Renice the waiter above all regular threads if needed. */
 			xnpod_renice_thread(thread, XNCORE_IRQ_PRIO);
 
-		xnsynch_sleep_on(&intr->synch_base, timeout);
+		xnsynch_sleep_on(&intr->synch_base, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(thread, XNRMID))
 			err = -EIDRM;	/* Interrupt object deleted while pending. */
ksrc/skins/posix/thread.c +2 -1
Index: xenomai/ksrc/skins/posix/thread.c
===================================================================
@@ -414,7 +414,8 @@ int pthread_join(pthread_t thread, void 
 
 		thread_cancellation_point(cur);
 
-		xnsynch_sleep_on(&thread->join_synch, XN_INFINITE);
+		xnsynch_sleep_on(&thread->join_synch, XN_INFINITE,
+				 XNTIMER_RELATIVE);
 
 		is_last_joiner =
 		    xnsynch_wakeup_one_sleeper(&thread->join_synch) == NULL;
ksrc/skins/psos+/event.c +1 -1
Index: xenomai/ksrc/skins/psos+/event.c
===================================================================
@@ -71,7 +71,7 @@ u_long ev_receive(u_long events, u_long 
 
 	psos_current_task()->waitargs.evgroup.flags = flags;
 	psos_current_task()->waitargs.evgroup.events = events;
-	xnsynch_sleep_on(&evgroup->synchbase, timeout);
+	xnsynch_sleep_on(&evgroup->synchbase, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&psos_current_task()->threadbase, XNTIMEO)) {
 		*events_r = psos_current_task()->waitargs.evgroup.events;
ksrc/skins/psos+/queue.c +1 -1
Index: xenomai/ksrc/skins/psos+/queue.c
===================================================================
@@ -365,7 +365,7 @@ static u_long q_receive_internal(u_long 
 		xnarch_post_graph_if(&queue->synchbase, 1,	/* PENDED */
 				     xnsynch_nsleepers(&queue->synchbase) == 0);
 
-		xnsynch_sleep_on(&queue->synchbase, timeout);
+		xnsynch_sleep_on(&queue->synchbase, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags
 		    (&psos_current_task()->threadbase, XNRMID)) {
ksrc/skins/psos+/rn.c +1 -1
Index: xenomai/ksrc/skins/psos+/rn.c
===================================================================
@@ -210,7 +210,7 @@ u_long rn_getseg(u_long rnid,
 		caller = psos_current_task();
 		caller->waitargs.region.size = size;
 		caller->waitargs.region.chunk = NULL;
-		xnsynch_sleep_on(&rn->synchbase, timeout);
+		xnsynch_sleep_on(&rn->synchbase, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&caller->threadbase, XNRMID))
 			err = ERR_RNKILLD;	/* Region deleted while pending. */
ksrc/skins/psos+/sem.c +1 -1
Index: xenomai/ksrc/skins/psos+/sem.c
===================================================================
@@ -178,7 +178,7 @@ u_long sm_p(u_long smid, u_long flags, u
 		if (sem->count > 0)
 			sem->count--;
 		else {
-			xnsynch_sleep_on(&sem->synchbase, timeout);
+			xnsynch_sleep_on(&sem->synchbase, timeout, XNTIMER_RELATIVE);
 
 			if (xnthread_test_flags
 			    (&psos_current_task()->threadbase, XNRMID))
ksrc/skins/psos+/task.c +2 -1
Index: xenomai/ksrc/skins/psos+/task.c
===================================================================
@@ -410,7 +410,8 @@ u_long t_suspend(u_long tid)
 		goto unlock_and_exit;
 	}
 
-	xnpod_suspend_thread(&task->threadbase, XNSUSP, XN_INFINITE, NULL);
+	xnpod_suspend_thread(&task->threadbase, XNSUSP, XN_INFINITE,
+			     XNTIMER_RELATIVE, NULL);
 
       unlock_and_exit:
 
ksrc/skins/rtdm/drvlib.c +17 -39

103 lines not on this page · raw message

ksrc/skins/uitron/flag.c +1 -1
Index: xenomai/ksrc/skins/uitron/flag.c
===================================================================
@@ -254,7 +254,7 @@ static ER wai_flg_helper(UINT *p_flgptn,
 	else {
 		task = ui_current_task();
 
-		xnsynch_sleep_on(&flg->synchbase, timeout);
+		xnsynch_sleep_on(&flg->synchbase, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&task->threadbase, XNRMID))
 			err = E_DLT;	/* Flag deleted while pending. */
ksrc/skins/uitron/mbx.c +1 -1
Index: xenomai/ksrc/skins/uitron/mbx.c
===================================================================
@@ -223,7 +223,7 @@ static ER rcv_msg_helper(T_MSG ** ppk_ms
 	else {
 		task = ui_current_task();
 
-		xnsynch_sleep_on(&mbx->synchbase, timeout);
+		xnsynch_sleep_on(&mbx->synchbase, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&task->threadbase, XNRMID))
 			err = E_DLT;	/* Flag deleted while pending. */
ksrc/skins/uitron/sem.c +1 -1
Index: xenomai/ksrc/skins/uitron/sem.c
===================================================================
@@ -205,7 +205,7 @@ static ER wai_sem_helper(ID semid, TMO t
 	else {
 		task = ui_current_task();
 
-		xnsynch_sleep_on(&sem->synchbase, timeout);
+		xnsynch_sleep_on(&sem->synchbase, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&task->threadbase, XNRMID))
 			err = E_DLT;	/* Semaphore deleted while pending. */
ksrc/skins/uitron/task.c +9 -6
Index: xenomai/ksrc/skins/uitron/task.c
===================================================================
@@ -226,7 +226,7 @@ void ext_tsk(void)
 	}
 
 	xnpod_suspend_thread(&ui_current_task()->threadbase,
-			     XNDORMANT, XN_INFINITE, NULL);
+			     XNDORMANT, XN_INFINITE, XNTIMER_RELATIVE, NULL);
 }
 
 void exd_tsk(void)
@@ -269,7 +269,8 @@ static void ter_tsk_helper(uitask_t * ta
 
 	xnpod_unblock_thread(&task->threadbase);
 
-	xnpod_suspend_thread(&task->threadbase, XNDORMANT, XN_INFINITE, NULL);
+	xnpod_suspend_thread(&task->threadbase, XNDORMANT, XN_INFINITE,
+			     XNTIMER_RELATIVE, NULL);
 	xnlock_put_irqrestore(&nklock, s);
 }
 
@@ -556,8 +557,8 @@ ER sus_tsk(ID tskid)
 	}
 
 	if (task->suspcnt++ == 0)
-		xnpod_suspend_thread(&task->threadbase,
-				     XNSUSP, XN_INFINITE, NULL);
+		xnpod_suspend_thread(&task->threadbase, XNSUSP,
+				     XN_INFINITE, XNTIMER_RELATIVE, NULL);
 	xnlock_put_irqrestore(&nklock, s);
 
 	return E_OK;
@@ -633,7 +634,8 @@ ER slp_tsk(void)
 
 	xnthread_set_flags(&task->threadbase, uITRON_TASK_SLEEP);
 
-	xnpod_suspend_thread(&task->threadbase, XNDELAY, XN_INFINITE, NULL);
+	xnpod_suspend_thread(&task->threadbase, XNDELAY, XN_INFINITE,
+			     XNTIMER_RELATIVE, NULL);
 
 	xnthread_clear_flags(&task->threadbase, uITRON_TASK_SLEEP);
 
@@ -674,7 +676,8 @@ ER tslp_tsk(TMO tmout)
 
 	xnthread_set_flags(&task->threadbase, uITRON_TASK_SLEEP);
 
-	xnpod_suspend_thread(&task->threadbase, XNDELAY, tmout, NULL);
+	xnpod_suspend_thread(&task->threadbase, XNDELAY, tmout,
+			     XNTIMER_RELATIVE, NULL);
 
 	xnthread_clear_flags(&task->threadbase, uITRON_TASK_SLEEP);
 
ksrc/skins/vrtx/event.c +1 -1
Index: xenomai/ksrc/skins/vrtx/event.c
===================================================================
@@ -252,7 +252,7 @@ int sc_fpend(int evid, long timeout, int
 	/* xnsynch_sleep_on() called for the current thread automatically
 	   reschedules. */
 
-	xnsynch_sleep_on(&evgroup->synchbase, timeout);
+	xnsynch_sleep_on(&evgroup->synchbase, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&task->threadbase, XNBREAK))
 		*errp = -EINTR;
ksrc/skins/vrtx/mb.c +1 -1
Index: xenomai/ksrc/skins/vrtx/mb.c
===================================================================
@@ -283,7 +283,7 @@ char *sc_pend(char **mboxp, long timeout
 	if (timeout)
 		task->vrtxtcb.TCBSTAT |= TBSDELAY;
 
-	xnsynch_sleep_on(&mb->synchbase, timeout);
+	xnsynch_sleep_on(&mb->synchbase, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&task->threadbase, XNBREAK)) {
 		*errp = -EINTR;
ksrc/skins/vrtx/mx.c +1 -1
Index: xenomai/ksrc/skins/vrtx/mx.c
===================================================================
@@ -267,7 +267,7 @@ void sc_mpend(int mid, unsigned long tim
 		if (timeout)
 			task->vrtxtcb.TCBSTAT |= TBSDELAY;
 
-		xnsynch_sleep_on(&mx->synchbase, timeout);
+		xnsynch_sleep_on(&mx->synchbase, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&task->threadbase, XNBREAK))
 			*errp = -EINTR;
ksrc/skins/vrtx/queue.c +1 -1
Index: xenomai/ksrc/skins/vrtx/queue.c
===================================================================
@@ -317,7 +317,7 @@ char *sc_qpend(int qid, long timeout, in
 	if (timeout)
 		task->vrtxtcb.TCBSTAT |= TBSDELAY;
 
-	xnsynch_sleep_on(&queue->synchbase, timeout);
+	xnsynch_sleep_on(&queue->synchbase, timeout, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&task->threadbase, XNBREAK)) {
 		*errp = -EINTR;
ksrc/skins/vrtx/sem.c +1 -1
Index: xenomai/ksrc/skins/vrtx/sem.c
===================================================================
@@ -242,7 +242,7 @@ void sc_spend(int semid, long timeout, i
 		if (timeout)
 			task->vrtxtcb.TCBSTAT |= TBSDELAY;
 
-		xnsynch_sleep_on(&sem->synchbase, timeout);
+		xnsynch_sleep_on(&sem->synchbase, timeout, XNTIMER_RELATIVE);
 
 		if (xnthread_test_flags(&task->threadbase, XNBREAK))
 			*errp = -EINTR;
ksrc/skins/vrtx/task.c +4 -2
Index: xenomai/ksrc/skins/vrtx/task.c
===================================================================
@@ -419,7 +419,8 @@ void sc_tsuspend(int tid, int opt, int *
 				task->vrtxtcb.TCBSTAT = TBSSUSP;
 
 				xnpod_suspend_thread(&task->threadbase,
-						     XNSUSP, XN_INFINITE, NULL);
+						     XNSUSP, XN_INFINITE,
+						     XNTIMER_RELATIVE, NULL);
 			}
 		}
 
@@ -450,7 +451,8 @@ void sc_tsuspend(int tid, int opt, int *
 
 	*errp = RET_OK;
 
-	xnpod_suspend_thread(&task->threadbase, XNSUSP, XN_INFINITE, NULL);
+	xnpod_suspend_thread(&task->threadbase, XNSUSP, XN_INFINITE,
+			     XNTIMER_RELATIVE, NULL);
       unlock_and_exit:
 
 	xnlock_put_irqrestore(&nklock, s);
ksrc/skins/vxworks/msgQLib.c +4 -2
Index: xenomai/ksrc/skins/vxworks/msgQLib.c
===================================================================
@@ -289,7 +289,8 @@ int msgQReceive(MSG_Q_ID qid, char *buf,
 		task->rcv_buf = buf;
 		task->rcv_bytes = bytes;
 
-		xnsynch_sleep_on(&queue->synchbase, timeout);
+		xnsynch_sleep_on(&queue->synchbase, timeout,
+				 XNTIMER_RELATIVE);
 
 		error_check(xnthread_test_flags(thread, XNBREAK), -EINTR,
 			    goto error);
@@ -364,7 +365,8 @@ STATUS msgQSend(MSG_Q_ID qid, const char
 			else
 				timeout = to;
 
-			xnsynch_sleep_on(&queue->synchbase, timeout);
+			xnsynch_sleep_on(&queue->synchbase, timeout,
+					 XNTIMER_RELATIVE);
 
 			error_check(xnthread_test_flags(thread, XNBREAK),
 				    -EINTR, goto error);
ksrc/skins/vxworks/semLib.c +2 -2
Index: xenomai/ksrc/skins/vxworks/semLib.c
===================================================================
@@ -270,7 +270,7 @@ static STATUS semb_take(wind_sem_t *sem,
 		error_check(to == XN_NONBLOCK, S_objLib_OBJ_UNAVAILABLE,
 			    return ERROR);
 
-		xnsynch_sleep_on(&sem->synchbase, to);
+		xnsynch_sleep_on(&sem->synchbase, to, XNTIMER_RELATIVE);
 
 		error_check(xnthread_test_flags(thread, XNBREAK), -EINTR,
 			    return ERROR);
@@ -345,7 +345,7 @@ static STATUS semm_take(wind_sem_t *sem,
 		error_check(to == XN_NONBLOCK, S_objLib_OBJ_UNAVAILABLE,
 			    return ERROR);
 
-		xnsynch_sleep_on(&sem->synchbase, to);
+		xnsynch_sleep_on(&sem->synchbase, to, XNTIMER_RELATIVE);
 
 		error_check(xnthread_test_flags(thread, XNBREAK), -EINTR,
 			    return ERROR);
ksrc/skins/vxworks/syscall.c +1 -1
Index: xenomai/ksrc/skins/vxworks/syscall.c
===================================================================
@@ -1166,7 +1166,7 @@ static int __wind_wd_wait(struct task_st
 		/* Renice the waiter above all regular tasks if needed. */
 		xnpod_renice_thread(&pTcb->threadbase, XNCORE_IRQ_PRIO);
 
-	xnsynch_sleep_on(&wd->synchbase, XN_INFINITE);
+	xnsynch_sleep_on(&wd->synchbase, XN_INFINITE, XNTIMER_RELATIVE);
 
 	if (xnthread_test_flags(&pTcb->threadbase, XNRMID))
 		err = -EIDRM;	/* Watchdog deleted while pending. */
ksrc/skins/vxworks/taskLib.c +4 -2
Index: xenomai/ksrc/skins/vxworks/taskLib.c
===================================================================
@@ -319,7 +319,8 @@ STATUS taskSuspend(TASK_ID task_id)
 	check_OBJ_ID_ERROR(task_id, wind_task_t, task, WIND_TASK_MAGIC,
 			   goto error);
 
-	xnpod_suspend_thread(&task->threadbase, XNSUSP, XN_INFINITE, NULL);
+	xnpod_suspend_thread(&task->threadbase, XNSUSP, XN_INFINITE,
+			     XNTIMER_RELATIVE, NULL);
 
 	xnlock_put_irqrestore(&nklock, s);
 
@@ -564,7 +565,8 @@ TASK_ID taskNameToId(const char *name)
 static int testSafe(wind_task_t *task)
 {
 	while (task->safecnt > 0) {
-		xnsynch_sleep_on(&task->safesync, XN_INFINITE);
+		xnsynch_sleep_on(&task->safesync, XN_INFINITE,
+				 XNTIMER_RELATIVE);
 		error_check(xnthread_test_flags(&task->threadbase, XNBREAK),
 			    -EINTR, return ERROR);
 	}