Changeset d12b313 in rtems


Ignore:
Timestamp:
May 2, 2015, 12:06:38 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
4438ac25
Parents:
b76dd97
git-author:
Sebastian Huber <sebastian.huber@…> (05/02/15 12:06:38)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/19/15 10:00:47)
Message:

score: Inline _CORE_semaphore_Surrender()

Location:
cpukit/score
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    rb76dd97 rd12b313  
    178178
    179179## CORE_SEMAPHORE_C_FILES
    180 libscore_a_SOURCES += src/coresem.c \
    181     src/coresemsurrender.c
     180libscore_a_SOURCES += src/coresem.c
    182181
    183182## CORE_SPINLOCK_C_FILES
  • cpukit/score/include/rtems/score/coresemimpl.h

    rb76dd97 rd12b313  
    2121
    2222#include <rtems/score/coresem.h>
     23#include <rtems/score/objectimpl.h>
    2324#include <rtems/score/threaddispatch.h>
    2425#include <rtems/score/threadqimpl.h>
     
    119120 *  @retval an indication of whether the routine succeeded or failed
    120121 */
    121 CORE_semaphore_Status _CORE_semaphore_Surrender(
     122RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
    122123  CORE_semaphore_Control                *the_semaphore,
    123124  Objects_Id                             id,
    124125  CORE_semaphore_API_mp_support_callout  api_semaphore_mp_support,
    125126  ISR_lock_Context                      *lock_context
    126 );
     127)
     128{
     129  Thread_Control *the_thread;
     130  CORE_semaphore_Status status;
     131
     132  status = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
     133
     134  _Thread_queue_Acquire_critical( &the_semaphore->Wait_queue, lock_context );
     135
     136  the_thread = _Thread_queue_First_locked( &the_semaphore->Wait_queue );
     137  if ( the_thread != NULL ) {
     138#if defined(RTEMS_MULTIPROCESSING)
     139    _Thread_Dispatch_disable();
     140#endif
     141
     142    _Thread_queue_Extract_critical(
     143      &the_semaphore->Wait_queue,
     144      the_thread,
     145      lock_context
     146    );
     147
     148#if defined(RTEMS_MULTIPROCESSING)
     149    if ( !_Objects_Is_local_id( the_thread->Object.id ) )
     150      (*api_semaphore_mp_support) ( the_thread, id );
     151
     152    _Thread_Dispatch_enable( _Per_CPU_Get() );
     153#endif
     154  } else {
     155    if ( the_semaphore->count < the_semaphore->Attributes.maximum_count )
     156      the_semaphore->count += 1;
     157    else
     158      status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED;
     159
     160    _Thread_queue_Release( &the_semaphore->Wait_queue, lock_context );
     161  }
     162
     163  return status;
     164}
    127165
    128166/**
Note: See TracChangeset for help on using the changeset viewer.