int
tbm_bufmgr_set_bo_lock_type(tbm_bufmgr bufmgr, tbm_bufmgr_bo_lock_type bo_lock_type)
{
+ pthread_mutex_lock(&gLock);
_tbm_bufmgr_mutex_lock();
+
_tbm_set_last_result(TBM_ERROR_NONE);
- TBM_BUFMGR_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(gBufMgr), 0);
- TBM_BUFMGR_RETURN_VAL_IF_FAIL(bufmgr == gBufMgr, 0);
+ TBM_GOTO_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(gBufMgr), failed);
+ TBM_GOTO_VAL_IF_FAIL(bufmgr == gBufMgr, failed);
- pthread_mutex_lock(&gLock);
gBufMgr->bo_lock_type = bo_lock_type;
- pthread_mutex_unlock(&gLock);
TBM_INFO("The bo_lock_type of the bo is %d\n", bo_lock_type);
_tbm_bufmgr_mutex_unlock();
+ pthread_mutex_unlock(&gLock);
return 1;
+
+failed:
+ _tbm_bufmgr_mutex_unlock();
+ pthread_mutex_unlock(&gLock);
+
+ return 0;
}