From: Jaeyun Date: Tue, 17 Sep 2019 07:10:23 +0000 (+0900) Subject: [Filter/Sub] use glib-mutex X-Git-Tag: accepted/tizen/unified/20190925.220436~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5df6eb80210fc3c0d2302fddf266972e1762f795;p=platform%2Fupstream%2Fnnstreamer.git [Filter/Sub] use glib-mutex remove pthread header and use g_mutex instead. Signed-off-by: Jaeyun Jung --- diff --git a/ext/nnstreamer/tensor_filter/tensor_filter_python_core.cc b/ext/nnstreamer/tensor_filter/tensor_filter_python_core.cc index 73cc457..eced0e3 100644 --- a/ext/nnstreamer/tensor_filter/tensor_filter_python_core.cc +++ b/ext/nnstreamer/tensor_filter/tensor_filter_python_core.cc @@ -106,7 +106,7 @@ PYCore::PYCore (const char* _script_path, const char* _custom) configured = false; /** to prevent concurrent Python C-API calls */ - pthread_mutex_init(&py_mutex, NULL); + g_mutex_init (&py_mutex); } /** @@ -127,6 +127,7 @@ PYCore::~PYCore () Py_Finalize(); dlclose(handle); + g_mutex_clear (&py_mutex); } /** diff --git a/ext/nnstreamer/tensor_filter/tensor_filter_python_core.h b/ext/nnstreamer/tensor_filter/tensor_filter_python_core.h index 38f6901..5defe8d 100644 --- a/ext/nnstreamer/tensor_filter/tensor_filter_python_core.h +++ b/ext/nnstreamer/tensor_filter/tensor_filter_python_core.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "nnstreamer_plugin_api_filter.h" @@ -76,9 +75,9 @@ public: /** @brief Return callback type */ cb_type getCbType () { return callback_type; } /** @brief Lock python-related actions */ - void Py_LOCK() { pthread_mutex_lock(&py_mutex); } + void Py_LOCK() { g_mutex_lock (&py_mutex); } /** @brief Unlock python-related actions */ - void Py_UNLOCK() { pthread_mutex_unlock(&py_mutex); } + void Py_UNLOCK() { g_mutex_unlock (&py_mutex); } PyObject* PyTensorShape_New (const GstTensorInfo *info); @@ -100,7 +99,7 @@ private: PyObject* core_obj; PyObject* shape_cls; - pthread_mutex_t py_mutex; + GMutex py_mutex; GstTensorsInfo inputTensorMeta; /**< The tensor info of input tensors */ GstTensorsInfo outputTensorMeta; /**< The tensor info of output tensors */