Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8374073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:50:26+00:00 2026-06-09T14:50:26+00:00

I am trying to invoke two independent threads by using Asynchronous Agent Library (AAL)

  • 0

I am trying to invoke two independent threads by using Asynchronous Agent Library (AAL) as included in in C++ (refer also to here for AAL description http://msdn.microsoft.com/en-us/library/dd492627.aspx). The Agents Library provides alternatives to shared state by letting you connect isolated components through an asynchronous communication model that is based on dataflow instead of control flow. Dataflow refers to a programming model where computations are made when all required data is available; control flow refers to a programming model where computations are made in a predetermined order.

As I do not want to wait for arbitrary data from one agent, I wanted to use Concurrency::send() and Concurrency::try_receive().
However, I have problems implementing the try_receive method (documentation can be found here http://msdn.microsoft.com/de-de/library/dd470874.aspx).

My current implementation:

ISource<bool>& _source;    
Concurrency::try_receive(_source, &Received,ITarget<CPlant*>::filter_method())

with CPlant as my data to be sent back to the agent where the _source-Message comes from. Agent1 sends a simple boolean “true” and Agent2 (that includes the code mentioned above) responses with the CPlant class. This is working with Concurrency::receive(), but I don’t want to block the further execution of the current agent.

Do you have a clue why I get compiling errors like

1>c:\users\robert\tum\da\src\sim\anlagensim\anlagensim\main.cpp(57): error C2782: 'bool Concurrency::try_receive(Concurrency::ISource<_Type> &,_Type &,const ITarget<_Type>::filter_method &)' : template parameter '_Type' is ambiguous
1>          c:\program files\microsoft visual studio 10.0\vc\include\agents.h(16553) : see declaration of 'Concurrency::try_receive'
1>          could be 'int *'
1>          or       'bool'
1>c:\users\robert\tum\da\src\sim\anlagensim\anlagensim\main.cpp(57): error C2780: 'bool Concurrency::try_receive(Concurrency::ISource<_Type> &,_Type &)' : expects 2 arguments - 3 provided

?

Thanks in advance for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:50:28+00:00Added an answer on June 9, 2026 at 2:50 pm

    I did another approach by using OpenMP that nicely support data sharing and thread management very easily.

    #include <omp.h>
    ...
    
    #pragma omp parallel shared(Simulation, cout) default(none) num_threads(3)
    {
        #pragma omp sections nowait
        {
            #pragma omp section 
            {
            ...
            }
    
            #pragma omp section 
            {
            ...
            }
    
            #pragma omp section
            {
            ...
            }
        }
    }
    

    Be advised to use /openmp switch while using Visual C++.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to invoke webservice using jquery ajax call. I am using jasonp
I'm trying to deploy two or more independent Play! (1.2.4) based projects to the
I am trying to invoke an EJB on JBoss 5.1.0 from two instances of
I am trying to convert between two classes and avoid a temporary object. Here
I am trying to run an application with at least two threads: One form
I am trying to invoke ExecuteNonQuery() method of two different objects of OracleCommand class.
I am trying to invoke Invoke on a Dispatcher using the following overload: public
I'm trying to create a Rake task that invokes two other rake tasks. I've
I am trying to invoke the method typeOfInstance() in the following (simplest) code: import
I'm trying to invoke a method from another class that means I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.