From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Lionel Perrin <perrin@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] How to make main sleep ? clock_nanosleep ? rt_alarm_wait ?
Date: Thu, 1 Jun 2006 10:44:04 +0200 [thread overview]
Message-ID: <17534.43220.103310.355438@domain.hid> (raw)
In-Reply-To: <447E9A1B.10507@domain.hid>
Lionel Perrin wrote:
> I got some difficulties to use either rt_alarm_wait or clock_nanosleep.
> It seems i haven't understood what's a "context that can sleep".
>
> First of all, what do we need to use clock_nanosleep ?
> Is it impossible to use this function in the main thread ?
Xenomai clock_nanosleep, nanosleep or rt_alarm_wait services are
reserved to Xenomai real-time threads, and will return an error of EPERM
otherwise.
If you want a non-realtime sleep, you may still access standard services
using __real_nanosleep or __real_clock_nanosleep.
If you want to obtain a Xenomai real-time thread using the posix skin
you have to make it use the SCHED_FIFO policy, either by creating it
with the pthread_create service, specifying non null creation attributes
or by changing the scheduling policy of an existing thread with
the pthread_setschedparam service.
If you want to obtain a Xenomai real-time thread using the native skin,
you may create it with the rt_task_create service or turn an existing
thread into a real-time thread with the rt_task_shadow service.
> (...)
> ret = nanosleep(&tp, &rmtp);
> switch (errno) {
> (...)
errno value is only meaningful if nanosleep returns -1. In particular it
is not garanteed to be zero if nanosleep did not fail.
--
Gilles Chanteperdrix.
next prev parent reply other threads:[~2006-06-01 8:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-01 7:41 [Xenomai-help] How to make main sleep ? clock_nanosleep ? rt_alarm_wait ? Lionel Perrin
2006-06-01 8:44 ` Gilles Chanteperdrix [this message]
2006-06-01 9:34 ` Lionel Perrin
2006-06-01 11:09 ` Gilles Chanteperdrix
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=17534.43220.103310.355438@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=perrin@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.