root/components/Modulator/trunk/Modulator/main.cpp @ 4079

Revision 4079, 2.2 KB (checked in by balister, 6 years ago)

Attempt to shut down orb cleaner.

Line 
1/****************************************************************************
2
3Copyright 2006, 2007 Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE Modulator.
6
7OSSIE Modulator is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12OSSIE Modulator is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OSSIE Modulator; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21****************************************************************************/
22
23#include <iostream>
24
25#include "ossie/ossieSupport.h"
26#include "ossie/debug.h"
27
28#include "Modulator.h"
29
30
31int main(int argc, char* argv[])
32
33{
34    ossieSupport::ORB *orb = new ossieSupport::ORB;
35    omni_mutex component_running_mutex;
36    omni_condition *component_running = new omni_condition(&component_running_mutex);
37
38    ossieDebugLevel = 3;
39
40    ossieSupport::ossieComponent modulator(orb, argc, argv);
41
42    Modulator_i* modulator_servant;
43    CF::Resource_var modulator_var;
44
45    // Create the modulator component servant and object reference
46
47    modulator_servant = new Modulator_i(modulator.getUuid(), component_running);
48    modulator_var = modulator_servant->_this();
49
50    PortableServer::ObjectId_var servantId = orb->poa->reference_to_id(modulator_var);
51    modulator.bind(modulator_var);
52
53    // This bit is ORB specific
54    // omniorb is threaded and the servants are running at this point
55    // so we block on the condition
56    // The releaseObject method clear the condition and the component exits
57
58    component_running->wait();
59
60    modulator.unbind();
61
62    DEBUG(4, Modulator, "Deactivate object.");
63    orb->poa->deactivate_object(servantId);
64
65    DEBUG(4, Modulator, "Destroy POA.");
66    orb->poa->destroy(false, false);
67
68    DEBUG(4, Modulator, "Shutting down orb.");
69    orb->orb->shutdown(0);
70
71}
Note: See TracBrowser for help on using the browser.