예제 #1
0
rtems_timer_service_routine test_release_from_isr(
  rtems_id  timer,
  void     *arg
)
{
  if ( getState() == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED ) {
    case_hit = true;
    (void) rtems_semaphore_release( Semaphore );
  }

  if ( Main_TCB->Wait.queue != NULL ) {
    _Thread_queue_Process_timeout( Main_TCB );
  }
}
예제 #2
0
파일: init.c 프로젝트: AlexShiLucky/rtems
static bool test_body(void *arg)
{
  test_context *ctx = arg;
  int busy;

  _Thread_Disable_dispatch();

  rtems_test_assert(
    ctx->semaphore_task_tcb->Wait.return_code
      == CORE_SEMAPHORE_STATUS_SUCCESSFUL
  );

  /*
   * Spend some time to make it more likely that we hit the test condition
   * below.
   */
  for (busy = 0; busy < 1000; ++busy) {
    __asm__ volatile ("");
  }

  if (ctx->semaphore_task_tcb->Wait.queue == NULL) {
    ctx->thread_queue_was_null = true;
  }

  _Thread_queue_Process_timeout(ctx->semaphore_task_tcb);

  switch (ctx->semaphore_task_tcb->Wait.return_code) {
    case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
      ctx->status_was_successful = true;
      break;
    case CORE_SEMAPHORE_TIMEOUT:
      ctx->status_was_timeout = true;
      break;
    default:
      rtems_test_assert(0);
      break;
  }

  _Thread_Enable_dispatch();

  return false;
}
예제 #3
0
void _CORE_RWLock_Timeout(
  Objects_Id  id,
  void       *ignored
)
{
  Thread_Control       *the_thread;
  Objects_Locations     location;

  the_thread = _Thread_Get( id, &location );
  switch ( location ) {
    case OBJECTS_ERROR:
#if defined(RTEMS_MULTIPROCESSING)
    case OBJECTS_REMOTE:  /* impossible */
#endif
      break;
    case OBJECTS_LOCAL:
      _Thread_queue_Process_timeout( the_thread );
      _Thread_Unnest_dispatch();
      break;
  }
}