2 #include "ace/Manual_Event.h"
4 Sender_i::Sender_i (CORBA::ULong no_clients
,
5 ACE_Manual_Event
&event
)
8 , no_clients_ (no_clients
)
12 ACE_NEW (this->receivers_
,
13 Receiver_var
[no_clients
]);
15 // Okay to have a magic number...
16 this->payload_
.length (32768);
18 for (CORBA::ULong j
= 0; j
!= this->payload_
.length (); ++j
)
19 this->payload_
[j
] = (j
% 256);
22 Sender_i::~Sender_i ()
24 delete []this->receivers_
;
28 Sender_i::receiver_object (Receiver_ptr recv
)
30 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
34 if (this->no_clients_
== this->last_index_
)
35 throw Sender::Table_Full ();
37 this->receivers_
[this->last_index_
] =
38 Receiver::_duplicate (recv
);
42 if (this->last_index_
== this->no_clients_
)
44 this->event_
.signal ();
47 return this->last_index_
;
52 Sender_i::send_message ()
54 // NOTE:No synchronization with purpose. Synchrnozing this is
55 // going to spoil the whole purpose of this test.
56 CORBA::ULong send_to
=
57 static_cast<CORBA::ULong
> (ACE_OS::rand () % this->no_clients_
);
59 this->receivers_
[send_to
]->receive_payload (this->payload_
);