All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Doug Brunner <dbrunner@domain.hid>
Cc: Xenomai-help@domain.hid
Subject: Re: [Xenomai-help] Sharing of access to RT_MUTEX, RT_QUEUE, and RT_TASK
Date: Tue, 31 Jan 2012 09:24:14 +0100	[thread overview]
Message-ID: <4F27A52E.2070608@domain.hid> (raw)
In-Reply-To: <1327992003.514524717@domain.hid>

On 01/31/2012 07:40 AM, Doug Brunner wrote:
> I'm working on an application where it would be convenient for several tasks within the same process to share access to single descriptors for mutexes, queues, and tasks, rather than each task having to separately bind to each one and keep its own RT_MUTEX/RT_QUEUE/RT_TASK.
>
> The documentation doesn't seem to speak to this issue, and I haven't been able to find a definitive answer through searches. Can anyone clarify whether or not this will lead to problems, e.g. task A is in the midst of locking a mutex when task B starts trying to obtain a lock itself, and bad results occur?

Descriptors in user-space only contain handles to kernel objects, they 
carry no object properties; on the contrary, their kernel space 
counterparts do carry object information.

So, from user-space, you can share descriptors between threads which 
belong to the same process freely. The same way, cloning a descriptor in 
user-space using bitwise-copy does produce a valid descriptor to the 
original object.

Binding is meant to be used in two cases:
- when the original object descriptor is not in the same address space 
(i.e. created by a different process, or created in kernel space)
- when the caller wants to wait for some object to be created, in which 
case the binding operation provides the required synchronization 
mechanism as a bonus.

In the case you describe, there is no problem in considering object 
descriptors as globally shared variables.

>
> Thanks,
>      Doug Brunner
>
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
>


-- 
Philippe.


      reply	other threads:[~2012-01-31  8:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31  6:40 [Xenomai-help] Sharing of access to RT_MUTEX, RT_QUEUE, and RT_TASK Doug Brunner
2012-01-31  8:24 ` Philippe Gerum [this message]

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=4F27A52E.2070608@domain.hid \
    --to=rpm@xenomai.org \
    --cc=Xenomai-help@domain.hid \
    --cc=dbrunner@domain.hid \
    /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.