Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Nested_Upcall_Crash / Client_Peer.cpp
blobabdf7c27e639e58069f0ef72062b733a044ac3fb
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 (void);
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(void)
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(void)
56 Crasher::Crasher(void)
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 // This tests hangs on OpenVMS when abort() is used.
67 // Also see Crashed_Callback test.
68 #if defined (ACE_OPENVMS)
69 ACE_OS::_exit ();
70 #else
71 ACE_OS::abort();
72 #endif
73 return 0;