ACE Tutorial 018
The FIFO Nature of ACE_Token


Our main() just keeps getting simpler! I guess that's a good thing.

What we've done is create two Task-derived objects that test different locking mechanisms. The Token object uses ACE_Token and the Mutex object uses ACE_Mutex. When you execute the application you should see quite a difference in thread utilization. At the end of the tutorial I've included a link to the output of a typical run of the application.



// page02.html,v 1.7 2000/03/19 20:09:32 jcej Exp

// Get our two Test derivatives...
#include "Token_i.h"
#include "Mutex_i.h"

int main(int,char**)
{
        // See what an ACE_Token does for us.
    Token token;
    token.run();

        // And now the ACE_Mutex.
    Mutex mutex;
    mutex.run();

    return(0);
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class Test_T <ACE_Mutex>;
template class Test_T <ACE_Token>;
template class ACE_Atomic_Op <ACE_Mutex, int>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate Test_T <ACE_Mutex>
#pragma instantiate Test_T <ACE_Token>
#pragma instantiate ACE_Atomic_Op <ACE_Mutex, int>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */





[Tutorial Index] [Continue This Tutorial]