bcap_core/src/dn_thread.c
HRESULT
release_mutex(MUTEX *pmutex)
{
  HRESULT hr = S_OK;

  if (pmutex == NULL)
    return E_INVALIDARG;

#if defined(_USE_WIN_API)
  if(*pmutex != NULL) {
    BOOL ret;
    ret = CloseHandle(*pmutex);
    if(ret != 0) {
      *pmutex = NULL;
    } else {
      hr = E_ACCESSDENIED;
    }
  }
#elif defined(_USE_LINUX_API)
  int ret;
  ret = pthread_mutex_destroy(pmutex);
  if(ret != 0) {
    hr = E_ACCESSDENIED;
  }
#else
  hr = _release_mutex(pmutex);
#endif

  return hr;
}
/**
 * @fn            HRESULT release_mutex(MUTEX *pmutex)
 * @brief         Releases mutex handle.
 * @param[in,out] pmutex The pointer of mutex handle to be released.
 * @note          Must not be reused until it is reinitialized
 */
@fn            HRESULT release_mutex(MUTEX *pmutex)
@brief         Releases mutex handle.
@param[in,out] pmutex The pointer of mutex handle to be released.
@note          Must not be reused until it is reinitialized
@fn HRESULT release_mutex ( MUTEX * pmutex ) @brief Releases mutex handle . @param [ in out ] pmutex The pointer of mutex handle to be released . @note Must not be reused until it is reinitialized
HRESULT
release_mutex(MUTEX *pmutex)
{
  HRESULT hr = S_OK;
  if (pmutex == NULL)
    return E_INVALIDARG;
#if defined(_USE_WIN_API)
  if(*pmutex != NULL) {
    BOOL ret;
    ret = CloseHandle(*pmutex);
    if(ret != 0) {
      *pmutex = NULL;
    } else {
      hr = E_ACCESSDENIED;
    }
  }
#elif defined(_USE_LINUX_API)
  int ret;
  ret = pthread_mutex_destroy(pmutex);
  if(ret != 0) {
    hr = E_ACCESSDENIED;
  }
#else
  hr = _release_mutex(pmutex);
#endif
  return hr;
}
HRESULT release_mutex ( MUTEX * pmutex ) { HRESULT hr = S_OK ; if ( pmutex == NULL ) return E_INVALIDARG ; #if defined ( _USE_WIN_API ) if ( * pmutex != NULL ) { BOOL ret ; ret = CloseHandle ( * pmutex ) ; if ( ret != 0 ) { * pmutex = NULL ; } else { hr = E_ACCESSDENIED ; } } #elif defined ( _USE_LINUX_API ) int ret ; ret = pthread_mutex_destroy ( pmutex ) ; if ( ret != 0 ) { hr = E_ACCESSDENIED ; } #else hr = _release_mutex ( pmutex ) ; #endif return hr ; }
@fn            HRESULT release_mutex(MUTEX *pmutex)
 @brief         Releases mutex handle.
@fn HRESULT release_mutex ( MUTEX * pmutex ) @brief Releases mutex handle .