static OMX_ERRORTYPE
_ctx_init (cc_ctx_t * app_ctx)
{
  check_common_context_t *p_ctx =
    tiz_mem_alloc (sizeof (check_common_context_t));

  if (!p_ctx)
    {
      return OMX_ErrorInsufficientResources;
    }

  p_ctx->signaled = OMX_FALSE;

  if (tiz_mutex_init (&p_ctx->mutex))
    {
      tiz_mem_free (p_ctx);
      return OMX_ErrorInsufficientResources;
    }

  if (tiz_cond_init (&p_ctx->cond))
    {
      tiz_mutex_destroy (&p_ctx->mutex);
      tiz_mem_free (p_ctx);
      return OMX_ErrorInsufficientResources;
    }

  * app_ctx = p_ctx;

  return OMX_ErrorNone;

}
Exemplo n.º 2
0
END_TEST

START_TEST (test_mutex_init_null)
{
  OMX_ERRORTYPE error = tiz_mutex_init (0);
  (void)error;
}
Exemplo n.º 3
0
END_TEST

START_TEST (test_mutex_lock_and_unlock)
{

  OMX_ERRORTYPE error = OMX_ErrorNone;
  tiz_mutex_t mutex;
  error = tiz_mutex_init (&mutex);

  fail_if (error != OMX_ErrorNone);

  tiz_mutex_lock (&mutex);
  tiz_mutex_unlock (&mutex);

  tiz_mutex_destroy (&mutex);

}
static OMX_ERRORTYPE
_ctx_init (cc_ctx_t * app_ctx)
{
  int i;
  check_common_context_t *p_ctx =
    tiz_mem_calloc (1, sizeof (check_common_context_t));

  if (!p_ctx)
    {
      return OMX_ErrorInsufficientResources;
    }

  for (i=0 ; i < MAX_EVENTS ; i++)
    {
      p_ctx->signaled[i] = OMX_FALSE;
      p_ctx->event[i] = OMX_EventMax;
    }

  if (tiz_mutex_init (&p_ctx->mutex))
    {
      tiz_mem_free (p_ctx);
      return OMX_ErrorInsufficientResources;
    }

  if (tiz_cond_init (&p_ctx->cond))
    {
      tiz_mutex_destroy (&p_ctx->mutex);
      tiz_mem_free (p_ctx);
      return OMX_ErrorInsufficientResources;
    }

  p_ctx->state = OMX_StateMax;
  p_ctx->p_hdr = NULL;
  p_ctx->flags = 0;
  p_ctx->port  = 0;
  p_ctx->index = 0;

  * app_ctx = p_ctx;

  return OMX_ErrorNone;

}