summaryrefslogtreecommitdiff
path: root/TAO/tests/RTScheduling/DT_Spawn/Thread_Action.h
blob: 37da9a5de01d85fadcb43f858f43d7ca03a84507 (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
//$Id$
#ifndef Thread_Action_H
#define Thread_Action_H

#include "tao/RTScheduling/RTScheduler.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
#include "ace/SString.h"

class Data
{
 public:
  ACE_CString data;
  RTScheduling::Current_var current;
};

class Test_Thread_Action:
public RTScheduling::ThreadAction
{
 public:
  Test_Thread_Action (void);

  virtual void _cxx_do (CORBA::VoidData data
			ACE_ENV_ARG_DECL_WITH_DEFAULTS)
    ACE_THROW_SPEC ((CORBA::SystemException));
};

#endif /*Thread_Action_H*/


Test_Thread_Action::Test_Thread_Action (void)
{
}

void
Test_Thread_Action::_cxx_do (CORBA::VoidData data
			     ACE_ENV_ARG_DECL)
     ACE_THROW_SPEC ((CORBA::SystemException))
{

  Data* tmp = (Data*) data;
  ACE_DEBUG ((LM_DEBUG,
	      "Test_Thread_Action::do %s\n",
	      tmp->data.c_str ()));

  size_t count = 0;
  ACE_OS::memcpy (&count,
		  tmp->current->id ()->get_buffer (),
		  tmp->current->id ()->length ());

  ACE_DEBUG ((LM_DEBUG,
	      "The spawned DT Guid is %d\n",
	      count));

  RTScheduling::Current::NameList_var segment_name_list =
    tmp->current->current_scheduling_segment_names (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK;

  ACE_DEBUG ((LM_DEBUG,
	      "Segment Names for DT %d:\n",
	      count));

  for (unsigned int i = 0; i < segment_name_list->length (); i ++)
    {
      ACE_DEBUG ((LM_DEBUG,
		  "%s\n",
      static_cast<char const*>((*segment_name_list) [i])));
    }
}