X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fevalyfx%2FYACSEvalSession.cxx;h=d08aa9c49db0d7846cfd9ce12a87a721468b7ce4;hb=53629c53c7f47f2d86aa47e31206e836290f055a;hp=250202fa4f8635c558ceca03c2e31e73e83ed5e6;hpb=db08bb61ce4791e8318874724baa1b27a8d506a1;p=modules%2Fyacs.git diff --git a/src/evalyfx/YACSEvalSession.cxx b/src/evalyfx/YACSEvalSession.cxx index 250202fa4..d08aa9c49 100644 --- a/src/evalyfx/YACSEvalSession.cxx +++ b/src/evalyfx/YACSEvalSession.cxx @@ -34,22 +34,17 @@ const char YACSEvalSession::CORBA_CONFIG_ENV_VAR_NAME[]="OMNIORB_CONFIG"; const char YACSEvalSession::NSPORT_VAR_NAME[]="NSPORT"; -YACSEvalSession::YACSEvalSession():_isAttached(false),_isLaunched(false),_port(-1),_salomeInstanceModule(0),_salomeInstance(0),_internal(new YACSEvalSessionInternal) +YACSEvalSession::YACSEvalSession():_isAttached(false),_isLaunched(false),_isForcedPyThreadSaved(false),_port(-1),_salomeInstanceModule(0),_salomeInstance(0),_internal(new YACSEvalSessionInternal) { - if(!Py_IsInitialized()) - Py_Initialize(); - // - { - YACS::ENGINE::AutoGIL gal; - _salomeInstanceModule=PyImport_ImportModule(const_cast("salome_instance")); - } + YACS::ENGINE::AutoGIL gal; + _salomeInstanceModule=PyImport_ImportModule(const_cast("salome_instance")); } YACSEvalSession::~YACSEvalSession() { delete _internal; YACS::ENGINE::AutoGIL gal; - if(isLaunched()) + if(isLaunched() && !isAttached()) { YACS::ENGINE::AutoPyRef terminateSession(PyObject_GetAttrString(_salomeInstance,const_cast("stop")));//new YACS::ENGINE::AutoPyRef res(PyObject_CallObject(terminateSession,0)); @@ -85,6 +80,12 @@ void YACSEvalSession::launchUsingCurrentSession() return ; YACS::ENGINE::AutoGIL gal; _corbaConfigFileName=GetConfigAndPort(_port); + _isAttached=true; _isLaunched=true; +} + +bool YACSEvalSession::isAlreadyPyThreadSaved() const +{ + return _isForcedPyThreadSaved; } void YACSEvalSession::checkLaunched() const