}
/* LCOV_EXCL_START */
-static bool
-_tbm_bufmgr_mutex_init(void)
-{
- static bool tbm_bufmgr_mutex_init = false;
-
- if (tbm_bufmgr_mutex_init)
- return true;
-
- if (pthread_mutex_init(&tbm_bufmgr_lock, NULL)) {
- TBM_ERR("fail: Cannot pthread_mutex_init for tbm_bufmgr_lock.\n");
- return false;
- }
-
- tbm_bufmgr_mutex_init = true;
-
- return true;
-}
void
_tbm_bufmgr_mutex_lock(void)
{
- if (!_tbm_bufmgr_mutex_init()) {
- TBM_ERR("fail: _tbm_bufmgr_mutex_init()\n");
- return;
- }
-
pthread_mutex_lock(&tbm_bufmgr_lock);
}
static int init_list = 0;
static struct list_head g_dummy_display_list;
-static pthread_mutex_t tbm_dummy_display_lock;
+static pthread_mutex_t tbm_dummy_display_lock = PTHREAD_MUTEX_INITIALIZER;
void _tbm_dummy_display_mutex_unlock(void);
struct _tbm_dummy_display {
struct list_head link;
};
-static bool
-_tbm_dummy_display_mutex_init(void)
-{
- static bool tbm_dummy_display_mutex_init = false;
-
- if (tbm_dummy_display_mutex_init)
- return true;
-
- if (pthread_mutex_init(&tbm_dummy_display_lock, NULL)) {
- TBM_ERR("fail: pthread_mutex_init for tbm_dummy_display_lock.\n");
- return false;
- }
-
- tbm_dummy_display_mutex_init = true;
-
- return true;
-}
-
void
_tbm_dummy_display_mutex_lock(void)
{
- if (!_tbm_dummy_display_mutex_init()) {
- TBM_ERR("fail: _tbm_dummy_display_mutex_init.\n");
- return;
- }
-
pthread_mutex_lock(&tbm_dummy_display_lock);
}
#include <pixman.h>
static tbm_bufmgr g_surface_bufmgr;
-static pthread_mutex_t tbm_surface_lock;
+static pthread_mutex_t tbm_surface_lock = PTHREAD_MUTEX_INITIALIZER;
void _tbm_surface_mutex_unlock(void);
#define C(b, m) (((b) >> (m)) & 0xFF)
}
}
-static bool
-_tbm_surface_mutex_init(void)
-{
- static bool tbm_surface_mutex_init = false;
-
- if (tbm_surface_mutex_init)
- return true;
-
- if (pthread_mutex_init(&tbm_surface_lock, NULL)) {
- TBM_ERR("fail: pthread_mutex_init for tbm_surface_lock.\n");
- return false;
- }
-
- tbm_surface_mutex_init = true;
-
- return true;
-}
-
void
_tbm_surface_mutex_lock(void)
{
- if (!_tbm_surface_mutex_init()) {
- TBM_ERR("fail: _tbm_surface_mutex_init.\n");
- return;
- }
-
pthread_mutex_lock(&tbm_surface_lock);
}
#define NODE_LIST 4
static tbm_bufmgr g_surf_queue_bufmgr;
-static pthread_mutex_t tbm_surf_queue_lock;
+static pthread_mutex_t tbm_surf_queue_lock = PTHREAD_MUTEX_INITIALIZER;
void _tbm_surface_queue_mutex_unlock(void);
/* check condition */
unsigned int acquire_sync_count;
};
-static bool
-_tbm_surf_queue_mutex_init(void)
-{
- static bool tbm_surf_queue_mutex_init = false;
-
- if (tbm_surf_queue_mutex_init)
- return true;
-
- if (pthread_mutex_init(&tbm_surf_queue_lock, NULL)) {
- TBM_ERR("fail: pthread_mutex_init\n");
- return false;
- }
-
- tbm_surf_queue_mutex_init = true;
-
- return true;
-}
-
static void
_tbm_surf_queue_mutex_lock(void)
{
- if (!_tbm_surf_queue_mutex_init()) {
- TBM_ERR("fail: _tbm_surf_queue_mutex_init\n");
- return;
- }
-
pthread_mutex_lock(&tbm_surf_queue_lock);
}