aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBuddy Liong2015-05-05 14:24:39 -0500
committerBuddy Liong2015-05-05 14:24:39 -0500
commitfc0bd63ab3728743b0374a9696dd837f1012e913 (patch)
treeb3c8c9dfbc3bee9d6edab165a593b85d58b5a803 /libdce.c
parent5146b13160d7d1cf0b828104503aa67a88e7cc6d (diff)
downloadrepo-libdce-fc0bd63ab3728743b0374a9696dd837f1012e913.tar.gz
repo-libdce-fc0bd63ab3728743b0374a9696dd837f1012e913.tar.xz
repo-libdce-fc0bd63ab3728743b0374a9696dd837f1012e913.zip
libdce[LINUX] : Mutex protection support and other bug fixes
* The dce_init/dce_deinit APIs can be called multiple times by applications. This is called from multiple thread contexts in the viddec3test and is also invoked several times by the GStreamer framework. * But certain init functions and deinit operations need to be done only on the first and last calls of the respective APIs. * Additionally, according the pthread documentation we need to use **either** the PTHREAD_MUTEX_INITIALIZER or the pthread_mutex_init APIs with the attribs * The protection for the dce_init with the ref count mechanism is additionally needed for the mutex initialization because if this is not done conditionally (for the first dce_init) sequence, the subsequent call to this API would actually reinit the mutex value and cause the new thread sequence to acquire the same. Change-Id: I2d129a2b030a25c4e8c5f621abf05d68562db6b8 Signed-off-by: Karthik Ramanan <a0393906@ti.com> Signed-off-by: Buddy Liong <buddy.budiono@ti.com>
Diffstat (limited to 'libdce.c')
-rw-r--r--libdce.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libdce.c b/libdce.c
index 7704613..108d8f3 100644
--- a/libdce.c
+++ b/libdce.c
@@ -50,7 +50,13 @@
50/* Handle used for Remote Communication */ 50/* Handle used for Remote Communication */
51MmRpc_Handle MmRpcHandle[MAX_REMOTEDEVICES] = { NULL}; 51MmRpc_Handle MmRpcHandle[MAX_REMOTEDEVICES] = { NULL};
52Engine_Handle gEngineHandle[MAX_INSTANCES][MAX_REMOTEDEVICES] = { {NULL, NULL}}; 52Engine_Handle gEngineHandle[MAX_INSTANCES][MAX_REMOTEDEVICES] = { {NULL, NULL}};
53
54#ifdef BUILDOS_LINUX
55pthread_mutex_t ipc_mutex;
56#else
53pthread_mutex_t ipc_mutex = PTHREAD_MUTEX_INITIALIZER; 57pthread_mutex_t ipc_mutex = PTHREAD_MUTEX_INITIALIZER;
58#endif
59
54static int __ClientCount[MAX_REMOTEDEVICES] = {0}; 60static int __ClientCount[MAX_REMOTEDEVICES] = {0};
55int dce_debug = DCE_DEBUG_LEVEL; 61int dce_debug = DCE_DEBUG_LEVEL;
56const String DCE_DEVICE_NAME[MAX_REMOTEDEVICES]= {"rpmsg-dce","rpmsg-dce-dsp"}; 62const String DCE_DEVICE_NAME[MAX_REMOTEDEVICES]= {"rpmsg-dce","rpmsg-dce-dsp"};