From 5df6eb80210fc3c0d2302fddf266972e1762f795 Mon Sep 17 00:00:00 2001 From: Jaeyun Date: Tue, 17 Sep 2019 16:10:23 +0900 Subject: [PATCH] [Filter/Sub] use glib-mutex remove pthread header and use g_mutex instead. Signed-off-by: Jaeyun Jung --- ext/nnstreamer/tensor_filter/tensor_filter_python_core.cc | 3 ++- ext/nnstreamer/tensor_filter/tensor_filter_python_core.h | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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 */ -- 2.7.4