summaryrefslogtreecommitdiff
path: root/TAO/tests/Client_Leaks/Client_Task.h
blob: bf1cdcbe9009041bbcc21759d6dc13e989255133 (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
43
44
45
46
47
48
49
50
51
52
//
// $Id$
//

#ifndef CLIENT_LEAKS_CLIENT_TASK_H
#define CLIENT_LEAKS_CLIENT_TASK_H
#include "ace/pre.h"

#include "TestC.h"
#include "ace/Task.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

/// Implement a Task to run the experiments using multiple threads.
class Client_Task : public ACE_Task_Base
{
public:
  /// Constructor
  Client_Task (Test::Process_Factory_ptr process_Factory,
               int iterations);

  /// Return the total number of sucessful calls
  int successful_calls (void) const;

  /// Thread entry point
  int svc (void);

private:
  /// Run one iteration of the test
  int one_iteration (TAO_ENV_SINGLE_ARG_DECL);

  /// Make sure that the thread has a connection available
  void validate_connection (TAO_ENV_SINGLE_ARG_DECL);

private:
  /// Reference to the test interface
  Test::Process_Factory_var process_factory_;

  /// Total number of processes created by each thread
  int iterations_;

  /// At least some calls must be successful
  int successful_calls_;

  /// Implement the Monitor Object Pattern.
  TAO_SYNCH_MUTEX mutex_;
};

#include "ace/post.h"
#endif /* CLIENT_LEAKS_CLIENT_TASK_H */