summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Notify_Worker_Task.h
blob: 5933500078cd01a5d1002574cb61d80f0b25836c (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* -*- C++ -*- */
// Notify_Worker_Task.h,v 1.1 2000/07/19 02:40:06 pradeep Exp
//$Id$
//
// ============================================================================
//
// = LIBRARY
//   ORBSVCS Notification
//
// = FILENAME
//   Notify_Worker_Task.h
//
// = DESCRIPTION
//   Worker task used by the event processor.
//
// = AUTHOR
//   Pradeep Gore <pradeep@cs.wustl.edu>
//
// ============================================================================

#ifndef	TAO_NOTIFY_WORKER_TASK_H
#define	TAO_NOTIFY_WORKER_TASK_H

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

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

#include "tao/corba.h"
#include "Notify_Command.h"
#include "notify_export.h"

class TAO_Notify_Event_Manager;

class TAO_Notify_Export	TAO_Notify_Worker_Task : public	ACE_Task<ACE_SYNCH>
{
  // = TITLE
  //   TAO_Notify_Worker_Task
  //
  // = DESCRIPTION
  //   A worker	task that we use for various event processing jobs.
  //   Also see	TAO_Notify_Command - This task executes	Notify_Command objects.
  //
public:
  // = Initialization and termination code
  TAO_Notify_Worker_Task (TAO_Notify_Event_Manager* event_manager, CORBA::Boolean activate_object);
  // Constructor.

  virtual int open (void *args);
  // Activate the task if <active_object_> is set.

  virtual int svc (void);
  // svc command objects stored	in the message queue.

  void shutdown	(CORBA::Environment& ACE_TRY_ENV);
  // shutdown this task.

  virtual int process_event (TAO_Notify_Command	*mb, CORBA::Environment& ACE_TRY_ENV, ACE_Time_Value *tv = 0);
  // Allows the	producer to pass messages to the <Message_Block>.

  TAO_Notify_Event_Manager* event_manager (void);
  // access manager.

 protected:
  virtual int close (u_long);
  // Close hook.

  TAO_Notify_Event_Manager* event_manager_;
  // The Event Manager using us.

  CORBA::Boolean activate_object_;
  // Is	this an	active object.
};

//****************************************************************************************

class TAO_Notify_Export	TAO_Notify_Shutdown_Command : public TAO_Notify_Command
{
  // = TITLE
  //   TAO_Notify_Shutdown_Command
  //
  // = DESCRIPTION
  //   Shutdown	command	to shutdown the	task.
  //
 public:
  virtual int execute (TAO_Notify_Worker_Task* parent_task, CORBA::Environment&);
  // Returns -1. This signals worker threads to	finish servicing requests.
};

//****************************************************************************************

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