summaryrefslogtreecommitdiff
path: root/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.h
blob: d44ecbddd33bec96f0e0d3dc71455e2e71b10afc (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
53
54
55
56
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/tests
//
// = FILENAME
//    Util_Thread.h
//
// = AUTHOR
//    Andy Gokhale, Sumedh Mungee, and Sergio Flores-Gaitan
//
// ============================================================================

#if !defined (UTIL_THREAD_H)
#define UTIL_THREAD_H

#include "Task_Client.h"

class Util_Thread : public ACE_Task<ACE_SYNCH>
{
  // = TITLE
  //     The thread that computes utilization.
public:
  Util_Thread (Task_State *,
               ACE_Thread_Manager *thr_mgr);
  // Constructor.

  virtual int svc (void);
  // The thread entry point function.

  double get_number_of_computations (void);
  // Gets the number of computations the thread was able to perform.

  void computation (void);
  // this is the actual "computation" being performed.

  int done_;
  // Indicates whether we're done.

private:
  int run_computations (void);
  // Run the computations.

  double number_of_computations_;
  // This stores the number of computations performed
  // by the Util_Thread so far

  Task_State *ts_;
  // Pointer to the Task state. Stores the state
  // common to the multiple client threads
};

#endif /* !defined (UTIL_THREAD_H) */