All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anders Blomdell <anders.blomdell@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] rt_cond_wait doesn't timeout (xenomai 2.4.1)
Date: Mon, 03 Mar 2008 11:30:50 +0100	[thread overview]
Message-ID: <47CBD35A.6030305@domain.hid> (raw)
In-Reply-To: <2ff1a98a0802290958k3457d577j8e2ad01079612320@domain.hid>

Gilles Chanteperdrix wrote:
> On Fri, Feb 29, 2008 at 5:54 PM, Anders Blomdell
> <anders.blomdell@domain.hid> wrote:
>> Hi,
>>
>>  with xenomai 2.4.1 my call to:
>>
>>   rt_cond_wait(&cond, &mutex, 1000);
>>
>>  doesn't timeout (signalling works OK). Kernel version is 2.6.23.12, can it be
>>  due to CONFIG_NO_HZ=y, or have I misunderstood something?
> 
> What is your system timer setting ? Are you running in periodic or
> aperiodic mode ? If aperiodic, 1000 ticks means 1000 ns, that is 1us,
> so rt_cond_wait should return instantaneously.
OK, here comes a simplified program that just outputs A, and then hangs.

#include <sys/mman.h>
#include <native/cond.h>
#include <native/mutex.h>
#include <native/task.h>
#include <native/timer.h>

int main(int argc, char *argv[])
{
  RT_MUTEX mutex;
  RT_COND cond;
  RT_TASK task_main;

  mlockall(MCL_CURRENT|MCL_FUTURE);

  rt_task_shadow(&task_main, "main", 1, T_FPU);
  if (rt_mutex_create(&mutex, NULL)) {
    fprintf(stderr, "Failed to create mutex\n");
    exit(1);
  }
  if (rt_cond_create (&cond, NULL)) {
    fprintf(stderr, "Failed to create condition\n");
    exit(1);
  }

  if (rt_timer_set_mode(TM_ONESHOT)) {
    fprintf(stderr, "Failed to set timer mode\n");
    exit(1);
  }

  rt_mutex_acquire(&mutex, TM_INFINITE);
  printf("A\n");
  rt_cond_wait(&cond, &mutex, 1000);
  printf("B\n");
  rt_mutex_release(&mutex);
  exit(0);
}

Probaly something extremely simple I have overlooked (SIGH).

Regards

Anders


-- 
Anders Blomdell                  Email: anders.blomdell@domain.hid
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden


  reply	other threads:[~2008-03-03 10:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29 16:54 [Xenomai-help] rt_cond_wait doesn't timeout (xenomai 2.4.1) Anders Blomdell
2008-02-29 17:58 ` Gilles Chanteperdrix
2008-03-03 10:30   ` Anders Blomdell [this message]
2008-03-03 11:00     ` Philippe Gerum
2008-03-03 11:08       ` Anders Blomdell
2008-03-03 11:22         ` Philippe Gerum
2008-03-03 11:26           ` Anders Blomdell
2008-03-03 11:43             ` Jan Kiszka
2008-03-03 12:48             ` Philippe Gerum
2008-03-03 13:27               ` Gilles Chanteperdrix
2008-03-03 13:52                 ` Philippe Gerum
2008-03-03 16:02                 ` Anders Blomdell
2008-03-03 12:12           ` Anders Blomdell

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=47CBD35A.6030305@domain.hid \
    --to=anders.blomdell@domain.hid \
    --cc=gilles.chanteperdrix@xenomai.org \
    --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.