public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Rosimildo daSilva" <rosimildo@hotmail.com>
To: ecos-discuss@sourceware.cygnus.com
Subject: Re: [ECOS] No binary semaphore in C API?
Date: Fri, 30 Mar 2001 05:39:00 -0000	[thread overview]
Message-ID: <F233HO6YrKpRODrSD1X00010516@hotmail.com> (raw)

>From: Sergei Organov <osv@javad.ru>
>To: bartv@redhat.com
>CC: ecos-discuss@sourceware.cygnus.com
>Subject: Re: [ECOS] No binary semaphore in C API?
>Date: 30 Mar 2001 14:22:43 +0400
>

>I think that original post has a scenario for which there is no primitive 
>in
>eCos that exactly matches requirements and there will never be one I guess 
>as
>the problem that should be solved is rather complex and hopefully
>rare. Somebody (you?) described it as "mutual exclusion between thread
>groups". For me it belongs to the same class as read-write locks but
>apparently is even more complicated. One of solutions, IMHO, is to 
>implement
>special object on top of primitives that eCos provides and use it in the
>application. Then it will be this object that will take care of preserving
>semantics of eCos primitives it uses. And if it is possible to build it on 
>top
>of current binary semaphore, it is also possible to build it on top of 
>current
>counting semaphore, I believe.
>
>I'm still not convinced that tuning eCos primitive for such questionable 
>usage
>is a good idea especially as it prohibits another possible application.
>


I believe that the primitive(s) that Sergei was talking about
is more in line with the semantic of the WIN32/OS/2 "Event"
primitives. Something that has a semantic of a switch ( on/off ).

This semaphore, called from now "EventX", has two states,

  + Reseted, Posted.

Once reseted, any thread "waiting" on that semaphore will block. Once,
the semaphore is "posted", all threads are unblocked, and it remains on that 
state until it is explicited put back on the "Reseted" state.

Interface:

  class EventX
  {
    public:

    void post();
    bool wait( some timeout here );
    void reset();
  };

As he mentioned on the first message, this type of primitive
is very handy, because you do not need a "thread id" of the
receiving thread to be used. I have used the "Binary"
semaphores to archieve this semantic in some cases,
but they never matches 100%.

Rosimildo.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

             reply	other threads:[~2001-03-30  5:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-30  5:39 Rosimildo daSilva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-16 12:01 Grant Edwards
2001-03-19 13:42 ` Jonathan Larmour
2001-03-26  3:53   ` Nick Garnett
2001-03-26  7:12     ` Fabrice Gautier
2001-03-26 11:37     ` Grant Edwards
2001-03-27  2:00       ` Nick Garnett
2001-03-27  5:32         ` Grant Edwards
2001-03-28  5:29         ` Bart Veer
2001-03-28  6:45           ` Sergei Organov
2001-03-28  7:38             ` Grant Edwards
2001-03-28  7:39             ` Bart Veer
2001-03-28 10:01               ` Sergei Organov
2001-03-28 11:05                 ` Grant Edwards
2001-03-29 11:51                   ` Sergei Organov
2001-03-29 11:49                     ` Grant Edwards
2001-03-28 10:01               ` Jonathan Larmour
2001-03-29 11:55           ` Chris Gray
2001-03-29 19:33             ` Bart Veer
2001-03-29 20:50               ` Grant Edwards
2001-03-30  2:22               ` Sergei Organov
2001-03-30  6:54                 ` Grant Edwards
2001-03-30  7:42                   ` Sergei Organov

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=F233HO6YrKpRODrSD1X00010516@hotmail.com \
    --to=rosimildo@hotmail.com \
    --cc=ecos-discuss@sourceware.cygnus.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).