Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
ACE_Barrier
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Hubert Talbot  
View profile  
 More options Nov 11 2012, 11:35 am
Newsgroups: comp.soft-sys.ace
From: Hubert Talbot <Hubert.Tal...@criq.qc.ca>
Date: Sun, 11 Nov 2012 16:36:09 +0000
Local: Sun, Nov 11 2012 11:36 am
Subject: [ace-users] ACE_Barrier

Hi,

I have some problem with ACE_Barrier...

Can you help me please?

Thanks.

Hubert

    ACE VERSION: 6.0.4

    HOST MACHINE and OPERATING SYSTEM:

        Windows 7

    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
    COMPILER NAME AND VERSION (AND PATCHLEVEL):

    CONTENTS OF $ACE_ROOT/ace/config.h [if you use a link to a platform-
    specific file, simply state which one]:

        #define ACE_HAS_ICMP_SUPPORT 1
        #define __ACE_INLINE__ 1
        #include "ace/config-win32.h"

    CONTENTS OF $ACE_ROOT/include/makeinclude/platform_macros.GNU [if you
    use a link to a platform-specific file, simply state which one
    (unless this isn't used in this case, e.g., with Microsoft Visual
    C++)]:

    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
    (used by MPC when you generate your own makefiles):

    LEVEL OF URGENCY (LOW, MEDIUM, or HIGH):

        HIGH

    AREA/CLASS/EXAMPLE AFFECTED:
[What example failed?  What module failed to compile?]

        Please, see below for the source code.

    DOES THE PROBLEM AFFECT:
        COMPILATION?
        LINKING?
            On Unix systems, did you run make realclean first?
        EXECUTION?
        OTHER (please specify)?
[Please indicate whether ACE, your application, or both are affected.]

        EXECUTION

    SYNOPSIS:
[Brief description of the problem]

        Program crashes.

    DESCRIPTION:
[Detailed description of problem.  Don't just say "<blah>
doesn't work, here's a fix," explain what your program does
to get to the <blah> state. ]

        I'm trying to use a barrier with threads having arguments.
        The program does not always work. Sometimes the program crashes.

    REPEAT BY:
[What you did to get the error; include test program or session
transcript if at all possible.  ]

    SAMPLE FIX/WORKAROUND:
[If available ]

Source code:

//http://oss.org.cn/ossdocs/ace_tao/ACE-5.4+TAO-1.4+CIAO-0.4/ACE/tutori...

#include "ace/Thread.h"
#include "ace/OS.h"
#include "ace/Synch.h"
#include "ace/Log_Msg.h"

static int number=0;
static int seed=0;

class Args
{
public:
    Args(ACE_Barrier *barrier, long i)
        : barrier_(barrier)
        , i_(i)
    {
    }
    ACE_Barrier *barrier_;
    long i_;

};

static void * worker(void *arguments)
{
    Args *arg= (Args*)arguments;
    ACE_DEBUG((LM_DEBUG,"Thread (%t) Created to do some work: %d\n", arg->i_));
    ::number++;

    //Work
    //ACE_OS::sleep(ACE_OS::rand()%2);

    //Exiting now
    ACE_DEBUG((LM_DEBUG,
        "\tThread (%t) Done! \n\tThe number is now: %d\n",number));
    //Let the barrier know we are done.
    ACE_DEBUG((LM_DEBUG,"Thread (%t) is exiting \n"));
    arg->barrier_->wait();
    return 0;

}

int main(int argc, char *argv[])
{
    if(argc<2)
    {
        ACE_DEBUG((LM_DEBUG,"Usage: <program_name> <number of threads>\n"));
        ACE_OS::exit(1);
    }

    int n_threads=ACE_OS::atoi(argv[1]);
    //ACE_DEBUG((LM_DEBUG,"Preparing to spawn %d threads",n_threads));
    //Setup the random number generator
    ACE_OS::srand(::seed);

    //Setup arguments for threads
    ACE_Barrier barrier(n_threads);
    Args arg1(&barrier, 1);
    Args arg2(&barrier, 2);
    Args arg3(&barrier, 3);
    Args arg4(&barrier, 4);

    Args vect[] = {arg1, arg2, arg3, arg4};

    //Spawn off n_threads number of threads
    for(int i=0; i<n_threads; i++){ if(ACE_Thread::spawn((ACE_THR_FUNC)worker,(void*)&vect[i],THR_DETACHED|THR_ NEW_LWP)==-1)
        ACE_DEBUG((LM_DEBUG,"Error in spawning thread\n"));
    }

    //Wait for all the other threads to let the main thread
    // know that they are done using hte barrier
    barrier.wait();

    return 0;


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Douglas C. Schmidt  
View profile  
 More options Nov 11 2012, 11:38 am
Newsgroups: comp.soft-sys.ace
From: "Douglas C. Schmidt" <schm...@dre.vanderbilt.edu>
Date: Sun, 11 Nov 2012 10:38:35 -0600
Local: Sun, Nov 11 2012 11:38 am
Subject: Re: [ace-users] ACE_Barrier

Hi Hubert,

   Thanks for using the PRF.

Several questions:

1. Why are you using trying to use this ancient source code with ACE 6.0.4?

2. Have you tried running the ACE_ROOT/tests/Barrier_Test.cpp regression
   test in 6.0.4 to see how it works?  

Thanks,

        Doug        


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "RE : ACE_Barrier" by Hubert Talbot
Hubert Talbot  
View profile  
 More options Nov 11 2012, 1:56 pm
Newsgroups: comp.soft-sys.ace
From: Hubert Talbot <Hubert.Tal...@criq.qc.ca>
Date: Sun, 11 Nov 2012 18:57:28 +0000
Local: Sun, Nov 11 2012 1:57 pm
Subject: [ace-users] RE : ACE_Barrier
Hi Doug,

Thank you for the time you give me.

The two examples are slightly different.

Barrier_Test has only one 'args' with parameters while the example I provided (let's say 'A') has four.

I tested 'A' with only one parameter with spawn_n and it works perfectly.

'A' has a call to barrier.wait() while Barrier_Test has a call to ACE_Thread_Manager::instance ()->wait ();

Thanks

Hubert
________________________________________
De : ace-users-boun...@list.isis.vanderbilt.edu [ace-users-boun...@list.isis.vanderbilt.edu] de la part de Douglas C. Schmidt [schm...@dre.vanderbilt.edu]
Date d'envoi : 11 novembre 2012 11:38
À : Hubert Talbot
Cc : ace-us...@list.isis.vanderbilt.edu
Objet : Re: [ace-users] ACE_Barrier

Hi Hubert,

   Thanks for using the PRF.

Several questions:

1. Why are you using trying to use this ancient source code with ACE 6.0.4?

2. Have you tried running the ACE_ROOT/tests/Barrier_Test.cpp regression
   test in 6.0.4 to see how it works?

Thanks,

        Doug

_______________________________________________
ace-users mailing list
ace-us...@list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/ace-users

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Douglas C. Schmidt  
View profile  
 More options Nov 11 2012, 6:20 pm
Newsgroups: comp.soft-sys.ace
From: "Douglas C. Schmidt" <schm...@dre.vanderbilt.edu>
Date: Sun, 11 Nov 2012 17:20:49 -0600
Local: Sun, Nov 11 2012 6:20 pm
Subject: Re: [ace-users] RE : ACE_Barrier

Hi Hubert,

   Could you please enhance the the ACE_ROOT/tests/Barrier_Test.cpp
regression test in 6.0.4 so that it manifests the problem that you're
having?

Thanks,

        Doug


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johnny Willemsen  
View profile  
 More options Nov 13 2012, 8:47 am
Newsgroups: comp.soft-sys.ace
From: Johnny Willemsen <jwillem...@remedy.nl>
Date: Tue, 13 Nov 2012 14:47:28 +0100
Local: Tues, Nov 13 2012 8:47 am
Subject: Re: [ace-users] RE : ACE_Barrier
Hi,

I have integrated your extension on linux but there the test just
doesn't exit. Can you report this in bugzilla, something to look at later.

Johnny

On 11/13/2012 02:26 PM, Hubert Talbot wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »