Salome HOME
Merge branch 'V7_dev'
[modules/yacs.git] / src / runtime / CORBAPorts.cxx
index ee14bd161c9dc31df52ebd6a83d4e89db2a1c26a..aeba65639af0882fcff5729ddef54e1032963330 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -29,6 +29,7 @@
 #include "RuntimeSALOME.hxx"
 #include "TypeConversions.hxx"
 #include "TypeCode.hxx"
+#include "AutoLocker.hxx"
 #include "CORBAPorts.hxx"
 #include "PythonPorts.hxx"
 #include "ServiceNode.hxx"
@@ -165,7 +166,7 @@ void InputCorbaPort::put(CORBA::Any *data) throw (ConversionException)
 #ifdef REFCNT
   DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
 #endif
-  YACS::BASES::Lock lock(&_mutex);
+  YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
 #ifdef _DEVDEBUG_
   display(data);
 #endif
@@ -207,7 +208,7 @@ CORBA::Any * InputCorbaPort::getAny()
 
 PyObject * InputCorbaPort::getPyObj()
 {
-  YACS::BASES::Lock lock(&_mutex);
+  YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
   CORBA::TypeCode_var tc=getAny()->type();
   if (!tc->equivalent(CORBA::_tc_null))
     return convertCorbaPyObject(edGetType(),getAny());
@@ -318,7 +319,7 @@ void OutputCorbaPort::put(CORBA::Any *data) throw (ConversionException)
   InputPort *p;
 
   {  
-    YACS::BASES::Lock lock(&_mutex);
+    YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
 #ifdef REFCNT
     DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
 #endif
@@ -422,7 +423,7 @@ CORBA::Any * OutputCorbaPort::getAnyOut()
 
 PyObject * OutputCorbaPort::getPyObj()
 {
-  YACS::BASES::Lock lock(&_mutex);
+  YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
   CORBA::TypeCode_var tc=getAny()->type();
   if (!tc->equivalent(CORBA::_tc_null))
     return convertCorbaPyObject(edGetType(),getAny());