Changeset 272a80b7 in rtems


Ignore:
Timestamp:
May 22, 2014, 7:31:13 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10
Children:
f8811e4
Parents:
907cfb1
git-author:
Sebastian Huber <sebastian.huber@…> (05/22/14 07:31:13)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/23/14 07:04:17)
Message:

score: PR2179: Fix initially locked PCP mutexes

Elevate the priority of the creating task to the ceiling priority in
case a semaphore is created as initially locked.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/coremutex.c

    r907cfb1 r272a80b7  
    6565    if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
    6666         _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
     67      Priority_Control ceiling = the_mutex->Attributes.priority_ceiling;
    6768
    68       if ( _Thread_Executing->current_priority <
    69              the_mutex->Attributes.priority_ceiling )
     69      if ( _Thread_Executing->current_priority < ceiling )
    7070       return CORE_MUTEX_STATUS_CEILING_VIOLATED;
    7171#ifdef __RTEMS_STRICT_ORDER_MUTEX__
     
    7676
    7777      _Thread_Executing->resource_count++;
     78      _Thread_Change_priority( _Thread_Executing, ceiling, false );
    7879    }
    7980  } else {
  • testsuites/sptests/sp65/init.c

    r907cfb1 r272a80b7  
    2525);
    2626
     27static void assert_priority(rtems_task_priority expected)
     28{
     29  rtems_status_code sc;
     30  rtems_task_priority prio;
     31
     32  sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio);
     33  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     34
     35  rtems_test_assert(prio == expected);
     36}
     37
    2738rtems_task Init(
    2839  rtems_task_argument ignored
     
    3344
    3445  puts( "\n\n*** TEST " TEST_NAME " ***" );
     46
     47  /*
     48   * Verify that an initially locked priority ceiling mutex elevates the
     49   * priority of the creating task.
     50   */
     51
     52  status = rtems_semaphore_create(
     53    rtems_build_name( 's','e','m','1' ),
     54    0,
     55    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
     56    1,
     57    &Mutex_id
     58  );
     59  rtems_test_assert(status == RTEMS_SUCCESSFUL);
     60
     61  assert_priority(1);
     62
     63  status = rtems_semaphore_release(Mutex_id);
     64  rtems_test_assert(status == RTEMS_SUCCESSFUL);
     65
     66  assert_priority(TASK_PRIORITY);
     67
     68  status = rtems_semaphore_delete(Mutex_id);
     69  rtems_test_assert(status == RTEMS_SUCCESSFUL);
    3570
    3671  /*
Note: See TracChangeset for help on using the changeset viewer.