summaryrefslogtreecommitdiff
path: root/TAO/tests/CSD_Strategy_Tests/TP_Common/AppShutdown.h
blob: d79c2aababf79a9e6839a681e0905f4f3330812b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// $Id$
#ifndef APP_SHUTDOWN_H
#define APP_SHUTDOWN_H

#include "CSD_TP_Test_Export.h"
#include "OrbShutdownTask.h"
#include "tao/ORB.h"

class CSD_TP_Test_Export AppShutdown
{
  public:

    AppShutdown();
    virtual ~AppShutdown();

    void init(CORBA::ORB_ptr orb, 
              unsigned num_clients
              ACE_ENV_ARG_DECL);

    void wait ();
    
    void client_done();

    static AppShutdown* instance ();

  private:

    typedef ACE_SYNCH_MUTEX LockType;
    typedef ACE_Guard<LockType> GuardType;

    LockType lock_;
    CORBA::ORB_var orb_;
    unsigned num_clients_;
    unsigned num_clients_shutdown_;

    OrbShutdownTask orb_shutdown_task_;
};


#define TheAppShutdown AppShutdown::instance()

#endif