[Ace-users] [ace-users] Message Passing Between Two Tasks

Steve Huston shuston at riverace.com
Fri Dec 14 16:13:39 CST 2007

Hi Vlad,
Thank you for jumping right in and offering assistance on the list!
In this case, your suggestion adds more work than is necessary, as the
ACE_Message_Queue in each ACE_Task includes, and automatically uses,
the synchronization objects you suggest. Please review the design
rationale in C++NPv2 chapter 6 for further information.
I hope we hear more from you in the future.

Steve Huston, Riverace Corporation
Want to take ACE training on YOUR schedule?
See http://www.riverace.com/training.htm

-----Original Message-----
From: Vlad Imshenetskiy [mailto:Vlad.Imshenetskiy at capstoneco.com] 
Sent: Friday, December 14, 2007 12:52 PM
To: shuston at riverace.com; ddemland at marchnetworks.com;
ace-users at cse.wustl.edu
Subject: Re: [ace-users] Message Passing Between Two Tasks


I'm also new to ACE and maybe it has better tools but so far it sounds
to me like all you need is to use mutex and conditional variable.
Task1 locks the queue puts message on the queue signals task2 using
conditional variable. Task2 grabs a lock, checks if there are messages
on the queue, if not - waits on conditional variable for signal.
Depending on wether the tasks run on separate threads or processes (I
believe ACE has mutexes/cond var for processes as well as threads) use
proper ace tools.

Search ace docs for ace_mutex and ace_condition as there are a few
macros and classes and I don't remember exact names


----- Original Message -----
From: ace-users-bounces at cse.wustl.edu
<ace-users-bounces at cse.wustl.edu>
To: 'David Demland' <ddemland at marchnetworks.com>;
ace-users at cse.wustl.edu <ace-users at cse.wustl.edu>
Sent: Fri Dec 14 12:37:54 2007
Subject: Re: [ace-users] Message Passing Between Two Tasks

Hi David,

> Thank you for the information. I have been using the APG (First book
> got when it looked like I might go down the ACE path). I assumed
> there would be a way for the framework to sign up tasks and use the
> message queues. Here is what I was looking for:
>       Task1 ---->  Message Queue Task2 ---->  Task2


> In this case Task1 could tell Task2 to do something by
> placing a message
> in the message queue of Task2; then Task2 would be able to process
> message.


> You are right there will have to be a way for both tasks to know
> the queue.

Actually, what you need is for Task 1 to know about Task 2.

> I thought that ACE would have a way to advertise queues for
> tasks to know about them, but I am not sure how. Is there a
> way for the
> framework to advertise queues, or do I have something wrong with my
> assumptions?

You have something wrong in your assumptions, probably. There's no
general advertisement of available queues. However, if Task1 and Task2
were part of a Stream, they wouldn't need to know about each other,
Task 1 would simply forward the message along the stream and it would
get to Task 2.


Steve Huston, Riverace Corporation
Want to take ACE training on YOUR schedule?
See http://www.riverace.com/training.htm

ace-users mailing list
ace-users at mail.cse.wustl.edu

This message and any attachments (the "message") is intended solely
for the addressee and is confidential. This should not be construed as
an offer or solicitation to do business. If you receive this message
in error, please delete it and immediately notify the sender. Any
dissemination, duplication, publication to third parties or other use
of the contents of this e-mail or its attachments is forbidden. The
internet cannot guarantee the integrity of this message. The Capstone
Group (its subsidiaries) shall (will) not therefore be liable for the
message if modified. Please note that any views or opinions presented
in this email are solely those of the author and do not necessarily
represent those of the company. Although this information has been
compiled with great care, the Capstone Group shall not accept any
responsibility for any errors, omissions or other inaccuracies in this
information or for the consequences thereof, nor shall it be bound in
any way by the contents of this e-mail or its attachments. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. Finally, the recipient should
check this email and any attachments for the presence of viruses. The
company accepts no liability for any damage caused by any virus
transmitted by this email. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/ace-users/attachments/20071214/b4c68b6d/attachment.html 

More information about the Ace-users mailing list