Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Nested_Upcall_Crash / Client_Peer.cpp
blob3f90708246891cde4e9165321357c166ec81c856
1 /**
2 * @file Client_Peer.cpp
4 * @author Carlos O'Ryan <coryan@atdesk.com>
5 */
6 #include "Client_Peer.h"
7 #include "Clock_Ticks.h"
8 #include "tao/ORB_Core.h"
9 #include "ace/Reactor.h"
11 class Crasher : public ACE_Event_Handler
13 public:
14 Crasher ();
16 virtual int handle_timeout (ACE_Time_Value const & current_time,
17 void const * arg);
20 Client_Peer::Client_Peer (CORBA::ORB_ptr orb)
21 : orb_(CORBA::ORB::_duplicate(orb))
25 void
26 Client_Peer::callme(Test::Peer_ptr callback,
27 CORBA::ULong max_depth,
28 Test::Payload const &)
30 // ACE_DEBUG ((LM_DEBUG, "Received call, depth = %d\n", max_depth));
31 if (max_depth > 0)
33 Test::Peer_var me = this->_this ();
35 Test::Payload return_data;
37 callback->callme(me.in(), max_depth - 1, return_data);
41 void
42 Client_Peer::crash()
44 Crasher * crasher = new Crasher;
46 ACE_Time_Value clk_tck (0, Clock_Ticks::get_usecs_per_tick ());
47 ACE_Reactor * reactor = this->orb_->orb_core()->reactor();
48 reactor->schedule_timer(crasher, 0, clk_tck);
51 void
52 Client_Peer::noop()
56 Crasher::Crasher()
60 int
61 Crasher::handle_timeout (ACE_Time_Value const & ,
62 void const *)
64 // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Performing intentional crash
65 // %a\n"));
66 ACE_OS::abort();
67 return 0;