blob: 65f3bb282bbe03c154d74c5c2470b4ef11e98fc1 (
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
|
//$Id$
#include "Thread_Task.h"
#include "../Scheduler.h"
#include "tao/RTScheduling/RTScheduler_Manager.h"
#include "tao/ORB_Core.h"
int
main (int argc, char* argv [])
{
ACE_TRY_NEW_ENV
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc,
argv,
""
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
CORBA::Object_ptr manager_obj = orb->resolve_initial_references ("RTSchedulerManager"
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
TAO_RTScheduler_Manager_var manager = TAO_RTScheduler_Manager::_narrow (manager_obj
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
TAO_Scheduler scheduler (orb.in ());
manager->rtscheduler (&scheduler);
Thread_Task task;
task.activate_task (orb.in ());
ACE_DEBUG ((LM_DEBUG,
"Waiting for Threads to Activate...\n"));
ACE_OS::sleep (10);
ACE_DEBUG ((LM_DEBUG,
"Threads Activated\n"));
ACE_DEBUG ((LM_DEBUG,
"Cancelling Threads.....\n"));
CORBA::Object_ptr current_obj = orb->resolve_initial_references ("RTScheduler_Current");
RTScheduling::Current_var current = RTScheduling::Current::_narrow (current_obj
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
for (int i = 0; i < 4; i++)
{
RTScheduling::DistributableThread_var DT = current->lookup ((task.guids ())[i]
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
DT->cancel (ACE_ENV_SINGLE_ARG_PARAMETER);
}
orb->run ();
ACE_Thread_Manager::instance ()->wait ();
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"Caught exception:");
return 1;
}
ACE_ENDTRY;
return 0;
}
|