// CORBA Servant Launcher
QMutex _GUIMutex ;
- QWaitCondition _ServerLaunch;
+ QWaitCondition _ServerLaunch, _SessionStarted;
_GUIMutex.lock(); // to block Launch server thread until wait(mutex)
// 2. activate embedded CORBA servers: Registry, SALOMEDS, etc.
Session_ServerLauncher* myServerLauncher
- = new Session_ServerLauncher(argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch);
+ = new Session_ServerLauncher(argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch, &_SessionStarted);
myServerLauncher->start();
- _ServerLaunch.wait(&_GUIMutex); // to be reseased by Launch server thread when ready:
+ _ServerLaunch.wait(&_GUIMutex); // to be reseased by Launch server thread when ready
+
// show splash screen if "SPLASH" parameter was passed (default)
if ( isFound( "SPLASH", argc, argv ) )
{
if ( splash.getExitStatus() ) // 1 is error
exit( splash.getExitStatus() ); // quit applicaiton
}
+ else
+ _SessionStarted.wait();
// call Session::GetInterface() if "GUI" parameter was passed (default)
if ( isFound( "GUI", argc, argv ) )
CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
QMutex *GUIMutex,
- QWaitCondition *ServerLaunch)
+ QWaitCondition *ServerLaunch,
+ QWaitCondition *SessionStarted)
{
_argc = argc;
_argv = argv;
_root_poa = PortableServer::POA::_duplicate(poa);
_GUIMutex = GUIMutex;
_ServerLaunch = ServerLaunch;
+ _SessionStarted = SessionStarted;
}
//=============================================================================
void Session_ServerLauncher::run()
{
- MESSAGE("****>>> Session_ServerLauncher::run");
_GUIMutex->lock(); // lock released by calling thread when ready: wait(mutex)
- MESSAGE("****>>> Server Launcher thread free to go...");
- _GUIMutex->unlock();
- _ServerLaunch->wakeAll();
+ _GUIMutex->unlock();
+ _ServerLaunch->wakeAll();
+
CheckArgs();
ActivateAll();
+ _SessionStarted->wakeAll(); // wake main thread
+
_orb->run(); // this thread wait, during omniORB process events
}
argv[i+1] = _argv[(*itServ)._firstArg + i];
}
-std::cout << "*** activating [" << argc << "] : " << argv[0] << std::endl;
+ std::cout << "*** activating [" << argc << "] : " << argv[0] << std::endl;
Session_ServerThread* aServerThread
= new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
}
// Always launch Session Server
-
-std::cout << "*** activating [ SESSION ] " << std::endl;
+ std::cout << "*** activating [ SESSION ] " << std::endl;
int argc=1;
char** argv = new char*[argc];
MESSAGE("Session_ServerLauncher::KillAll()");
list<Session_ServerThread*>::reverse_iterator itServ;
for (itServ = _serverThreads.rbegin(); itServ !=_serverThreads.rend(); itServ++)
- {
- delete (*itServ);
- }
+ {
+ delete (*itServ);
+ }
}
CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
QMutex *GUIMutex,
- QWaitCondition *ServerLaunch);
+ QWaitCondition *ServerLaunch,
+ QWaitCondition *SessionStarted);
virtual ~Session_ServerLauncher();
void run();
void KillAll();
PortableServer::POA_var _root_poa;
QMutex* _GUIMutex;
QWaitCondition *_ServerLaunch;
+ QWaitCondition *_SessionStarted;
list<ServArg> _argServToLaunch;
vector<string> _argCopy;
list<Session_ServerThread*> _serverThreads;