public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Robert Cragie" <rcc@jennic.com>
To: "Carlos Camargo" <carlos_ivan_camargo@yahoo.com>,
	<ecos-discuss@sources.redhat.com>
Subject: RE: [ECOS] Serial Application
Date: Fri, 27 Apr 2001 04:13:00 -0000	[thread overview]
Message-ID: <NDBBLOIOMLKELOJBAPAGEEACCFAA.rcc@jennic.com> (raw)
In-Reply-To: <20010427103021.97448.qmail@web14006.mail.yahoo.com>

You could use the cyg_mbox_...() functions in conjunction with an array of
your structures initially organised in a linked list, maintaining a variable
which points to the head of this linked list (call this the 'free pool').

To send from Thread A to Thread B, Thread A would remove a structure from
(the head of) the free pool, fill its contents, then send to Thread B using
cyg_mbox_put(), with the pointer to this structure as the 'item' in
cyg_mbox_put().

Thread B would use cyg_mbox_get() (or cyg_mbox_timed_get()) to retrieve the
pointer value, which it would then dereference to get to the contents. Once
Thread B has finished with it, it can either reclaim it directly to the free
pool, in which case you would need a mutex to ensure only one thread can
access the free pool at any one time, or you could set up a mailbox to
return the pointer back to Thread A, which would then reclaim it; in this
case you wouldn't need mutex protection if only Thread A was ever going to
access the free pool.

Note the number of structures in your free pool should match the number of
entries in the mailbox, which is specified by
CYGNUM_KERNEL_SYNCH_MBOX_QUEUE_SIZE, and defaults to 10, I believe.

Hope this helps

Robert Cragie
Design Engineer
Jennic Ltd.
Furnival Street
Sheffield
S1 4QT
United Kingdom
Tel: +44 (0) 114 281 4512
Fax: +44 (0) 114 281 2951
mailto:rcc@jennic.com
http://www.jennic.com

> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com
> [ mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Carlos
> Camargo
> Sent: 27 April 2001 11:30
> To: ecos-discuss@sources.redhat.com
> Subject: RE: [ECOS] Serial Application
>
>
> Hi all..
>
> My problem is:
>
> I use mbox to transfer data between two threads, now i
> able to send only int data.
>
> I want send complex data with mbox, i define a struct
> (  more complex that the example in my previous mail),
> but i can't put or get messages of struct type.
>
> Thanks
>
> Carlos camargo
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/

  reply	other threads:[~2001-04-27  4:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-26 18:23 Ho Shui Choy Stanley PS03B NCS
2001-04-27  3:12 ` Robert Cragie
2001-04-27  3:30 ` Carlos Camargo
2001-04-27  4:13   ` Robert Cragie [this message]
2001-04-27  4:36     ` [ECOS] Sorry Carlos Camargo
  -- strict thread matches above, loose matches on Subject: below --
2001-05-09 17:54 [ECOS] Serial application Ho Shui Choy Stanley PS03B NCS
2001-05-09 19:33 ` Jonathan Larmour
2001-05-08 17:53 Ho Shui Choy Stanley PS03B NCS
2001-05-09 12:27 ` Jonathan Larmour
2001-05-08  1:43 Ho Shui Choy Stanley PS03B NCS
2001-05-07 23:52 Ho Shui Choy Stanley PS03B NCS
2001-05-08  6:30 ` Jonathan Larmour
2001-05-07 23:04 Ho Shui Choy Stanley PS03B NCS
2001-04-25 21:18 [ECOS] Serial Application Ho Shui Choy Stanley PS03B NCS
2001-04-26 11:14 ` Jonathan Larmour
2001-04-25  3:07 Ho Shui Choy Stanley PS03B NCS
2001-04-25  9:15 ` Jonathan Larmour

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=NDBBLOIOMLKELOJBAPAGEEACCFAA.rcc@jennic.com \
    --to=rcc@jennic.com \
    --cc=carlos_ivan_camargo@yahoo.com \
    --cc=ecos-discuss@sources.redhat.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).