All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Stefan Kisdaroczi <kisda@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] rt_task_bind() and timeout values
Date: Tue, 15 Jul 2008 08:25:15 +0200	[thread overview]
Message-ID: <487C42CB.5080405@domain.hid> (raw)
In-Reply-To: <487BF171.2090902@domain.hid>

Stefan Kisdaroczi wrote:
> Hi Philippe,
> 
> the attached patch fixed the problem for me.

Good spot. Now it's official, since four years that feature exists or so, nobody
actually used registry timeouts... Oh, well...

> However, i think that in the "break case" still EACCES is returned.
> Can the break be replaced with a "return ETIMEDOUT" ?
>

Yes, normally we should do that along with your patch. Actually, the most
appropriate fix would be to use an absolute timeout value internally, since the
nucleus allows it.

--- ksrc/nucleus/registry.c	(revision 4044)
+++ ksrc/nucleus/registry.c	(working copy)
@@ -711,7 +711,6 @@
 	xnobject_t *object;
 	xnthread_t *thread;
 	xntbase_t *tbase;
-	xnticks_t stime;
 	int err = 0;
 	spl_t s;

@@ -723,7 +722,8 @@

 	xnlock_get_irqsave(&nklock, s);

-	stime = xntbase_get_time(tbase);
+	if (timeout != TM_NONBLOCK && timeout != TM_INFINITE)
+		timeout += xntbase_get_time(tbase);

 	for (;;) {
 		object = registry_hash_find(key);
@@ -738,18 +738,8 @@
 			goto unlock_and_exit;
 		}

-		if (timeout != XN_INFINITE) {
-			xnticks_t now = xntbase_get_time(tbase);
-
-			if (stime + timeout >= now)
-				break;
-
-			timeout -= (now - stime);
-			stime = now;
-		}
-
 		thread->registry.waitkey = key;
-		xnsynch_sleep_on(&registry_hash_synch, timeout, XN_RELATIVE);
+		xnsynch_sleep_on(&registry_hash_synch, timeout, XN_ABSOLUTE);

 		if (xnthread_test_info(thread, XNTIMEO)) {
 			err = -ETIMEDOUT;
 --
Philippe.



  reply	other threads:[~2008-07-15  6:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 17:22 [Xenomai-help] rt_task_bind() and timeout values Stefan Kisdaroczi
2008-07-14 17:50 ` Philippe Gerum
2008-07-14 19:03   ` Stefan Kisdaroczi
2008-07-14 20:35     ` Philippe Gerum
2008-07-15  0:38       ` Stefan Kisdaroczi
2008-07-15  6:25         ` Philippe Gerum [this message]
2008-07-16 10:25           ` Stefan Kisdaroczi
2008-07-16 21:17             ` Philippe Gerum
2008-07-17 11:01               ` Stefan Kisdaroczi
2008-07-17 21:58                 ` Philippe Gerum
2008-07-15 14:28         ` Stefan Kisdaroczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=487C42CB.5080405@domain.hid \
    --to=rpm@xenomai.org \
    --cc=kisda@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.