All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Peter Pastor Sampedro <pastorsa@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] detect mode switches to primary mode
Date: Sat, 06 Nov 2010 16:34:09 +0100	[thread overview]
Message-ID: <4CD57571.3090006@domain.hid> (raw)
In-Reply-To: <AANLkTimhUUYDkHh6wJ_zL8dLJgCi+7F8kOXrA63LzTO9@domain.hid>

Peter Pastor Sampedro wrote:
> Hey Gilles,
> 
> Thanks for your prompt response !
> 
>> If you have a borderline thread sharing memory with a primary-mode only
>> thread, you are supposed to protect the accesses to the shared memory
>> with a mutex, then the borderline thread will automatically switch to
>> primary mode when it acquires the mutex. When it gets out of this
>> critical section and it calls a function which requires running in
>> secondary mode, then it will switch automatically to secondary mode.
> 
> That is exactly what I am doing. However, since I am linking my
> program against the posix skin, I may call some posix function in the
> non-real-time part of the boarder line thread which cause my thread to
> switch back to primary mode... which is exactly what I don't want it
> to do.
> 
> Anyways, thanks for letting me know that there is no clean way to see
> when/where mode switches from secondary to primary modes happen.

Posix function calls which cause this thread to switch to primary mode
require this to work correctly. So, you can not call them and hope to
remain in secondary mode. As explained here:
http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai#Compilation_flags.

Linking the application to Xenomai posix skin is not sufficient to have
this application use Xenomai services. The --wrap mechanism does this.
So, if you want to be sure to use Linux service instead of Xenomai
service, you should use the __real prefix.

In short, I do not understand what you are trying to do.

What about sending a small piece of code to explain it?
-- 
                                                                Gilles.


  parent reply	other threads:[~2010-11-06 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-06  2:26 [Xenomai-help] detect mode switches to primary mode Peter Pastor
2010-11-06 13:51 ` Gilles Chanteperdrix
     [not found]   ` <AANLkTimhUUYDkHh6wJ_zL8dLJgCi+7F8kOXrA63LzTO9@domain.hid>
2010-11-06 15:34     ` Gilles Chanteperdrix [this message]
2010-11-06 16:08     ` Gilles Chanteperdrix
2010-11-06 17:03   ` Peter Pastor
2010-11-06 18:20     ` Gilles Chanteperdrix
2010-11-06 19:43       ` Peter Pastor
2010-11-06 19:48         ` 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=4CD57571.3090006@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=pastorsa@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.