summaryrefslogtreecommitdiff
path: root/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.h
blob: d6e35ff894ae9d921422ae562ef4344ed406ed20 (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 FOOSERVANTLIST_H
#define FOOSERVANTLIST_H

#include "tao/ORB.h"
#include "tao/PortableServer/PortableServer.h"
#include "tao/PortableServer/Servant_Base.h"
#include "ace/SString.h"


class FooServantList
{
  public:

    FooServantList(const char* prefix,
                   unsigned num_servants,
                   unsigned num_clients,
                   CORBA::ORB_ptr orb);
    ~FooServantList();

    void create_and_activate(PortableServer::POA_ptr poa
                             ACE_ENV_ARG_DECL);

    void client_done(ACE_ENV_SINGLE_ARG_DECL);


  private:

    typedef ACE_SYNCH_MUTEX     LockType;
    typedef ACE_Guard<LockType> GuardType;

    PortableServer::ServantBase_var* servants_;
    ACE_CString prefix_;
    unsigned num_servants_;

    LockType num_clients_lock_;
    unsigned num_clients_;

    CORBA::ORB_var  orb_;
};

#endif