/* Set barriers to be interruptible by signals. */ static void pipe_interruptible(pipe_control_t *pipe) { Objects_Locations location; _Barrier_Get(pipe->readBarrier, &location)->Barrier.Wait_queue.state |= STATES_INTERRUPTIBLE_BY_SIGNAL; _Thread_Enable_dispatch(); _Barrier_Get(pipe->writeBarrier, &location)->Barrier.Wait_queue.state |= STATES_INTERRUPTIBLE_BY_SIGNAL; _Thread_Enable_dispatch(); }
/* Set barriers to be interruptible by signals. */ static void pipe_interruptible(pipe_control_t *pipe) { Objects_Locations location; Barrier_Control *the_barrier; the_barrier = _Barrier_Get(pipe->readBarrier, &location); the_barrier->Barrier.Wait_queue.state |= STATES_INTERRUPTIBLE_BY_SIGNAL; _Objects_Put( &the_barrier->Object ); the_barrier = _Barrier_Get(pipe->writeBarrier, &location); the_barrier->Barrier.Wait_queue.state |= STATES_INTERRUPTIBLE_BY_SIGNAL; _Objects_Put( &the_barrier->Object ); }
rtems_status_code rtems_barrier_wait( rtems_id id, rtems_interval timeout ) { Barrier_Control *the_barrier; ISR_lock_Context lock_context; Thread_Control *executing; the_barrier = _Barrier_Get( id, &lock_context ); if ( the_barrier == NULL ) { return RTEMS_INVALID_ID; } executing = _Thread_Executing; _CORE_barrier_Seize( &the_barrier->Barrier, executing, true, timeout, NULL, 0, &lock_context ); return _Barrier_Translate_core_barrier_return_code( executing->Wait.return_code ); }
epos_status_code epos_barrier_release( epos_id id, uint32_t *released ) { Barrier_Control *the_barrier; Objects_Locations location; if ( !released ) return RTEMS_INVALID_ADDRESS; the_barrier = _Barrier_Get( id, &location ); switch ( location ) { case OBJECTS_LOCAL: *released = _CORE_barrier_Release( &the_barrier->Barrier, id, NULL ); _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: #endif case OBJECTS_ERROR: break; } return RTEMS_INVALID_ID; }
rtems_status_code rtems_barrier_wait( rtems_id id, rtems_interval timeout ) { Barrier_Control *the_barrier; Objects_Locations location; the_barrier = _Barrier_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: case OBJECTS_ERROR: return RTEMS_INVALID_ID; case OBJECTS_LOCAL: _CORE_barrier_Wait( &the_barrier->Barrier, id, TRUE, timeout, NULL ); _Thread_Enable_dispatch(); return _Barrier_Translate_core_barrier_return_code( _Thread_Executing->Wait.return_code ); } return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ }
rtems_status_code rtems_barrier_wait( rtems_id id, rtems_interval timeout ) { Barrier_Control *the_barrier; Objects_Locations location; the_barrier = _Barrier_Get( id, &location ); switch ( location ) { case OBJECTS_LOCAL: _CORE_barrier_Wait( &the_barrier->Barrier, id, true, timeout, NULL ); _Thread_Enable_dispatch(); return _Barrier_Translate_core_barrier_return_code( _Thread_Executing->Wait.return_code ); #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: #endif case OBJECTS_ERROR: break; } return RTEMS_INVALID_ID; }
epos_status_code epos_barrier_delete( epos_id id ) { Barrier_Control *the_barrier; Objects_Locations location; the_barrier = _Barrier_Get( id, &location ); switch ( location ) { case OBJECTS_LOCAL: _CORE_barrier_Flush( &the_barrier->Barrier, NULL, CORE_BARRIER_WAS_DELETED ); _Objects_Close( &_Barrier_Information, &the_barrier->Object ); _Barrier_Free( the_barrier ); _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: #endif case OBJECTS_ERROR: break; } return RTEMS_INVALID_ID; }