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
|
//
// $Id$
//
#include "Sender.h"
ACE_RCSID(Stack_Recursion,
Sender,
"$Id$")
Sender::Sender (CORBA::ORB_ptr orb)
: message_count_ (0)
, byte_count_ (0)
, orb_ (CORBA::ORB::_duplicate (orb))
, is_done_ (false)
{
}
void
Sender::dump_results (void)
{
ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
ACE_DEBUG ((LM_DEBUG,
"Total messages = %d\n"
"Total bytes = %d\n",
this->message_count_,
this->byte_count_));
}
bool
Sender::is_done (void) const
{
return this->is_done_;
}
CORBA::Boolean
Sender::get_data (CORBA::ULong size,
Test::Payload_out payload
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
ace_mon,
this->mutex_,
0);
++this->message_count_;
payload =
new Test::Payload (size);
payload->length (size);
this->byte_count_ += size;
return 1;
}
CORBA::Long
Sender::get_event_count (void)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
ace_mon,
this->mutex_,
0);
return this->message_count_;
}
void
Sender::ping (void)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return;
}
void
Sender::shutdown (void)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (this->is_done_ == false)
{
ACE_GUARD (ACE_SYNCH_MUTEX,
ace_mon,
this->mutex_);
if (this->is_done_ == false)
this->is_done_ = true;
}
}
|