Changeset 187d93c in rtems-schedsim


Ignore:
Timestamp:
Apr 30, 2014, 6:24:50 PM (5 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
30430be
Parents:
8703c13
Message:

Allow Scheduler Simulator to "defer dispatch" until controlled

This is needed to prevent a semaphore delete from triggering a
preempt and breaking the mutex is owner debug check. Technically
we are running the same thread until the API call returns. But from
an RTEMS internals perspective, it was preempted at the _Object_Put().

When understanding this patch, it is important to remember that the
Scheduler Simulator is single threaded and faking out RTEMS. This
is one place where RTEMS would have preempted to a thread and when
we returned to rtems_semaphore_delete(), the _Object_Put() call
would have been made by the correct thread.

Location:
schedsim/shell/shared
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • schedsim/shell/shared/main_semdelete.c

    r8703c13 r187d93c  
     1/**
     2 *  @file
     3 *  @brief Task Delete Shell Command Implmentation
     4 */
     5
    16/*
    2  *  Task Delete Shell Command Implmentation
    3  *
    4  *  COPYRIGHT (c) 1989-2013.
     7 *  COPYRIGHT (c) 1989-2014.
    58 *  On-Line Applications Research Corporation (OAR).
    69 *
     
    4548  printf("Deleting semaphore (0x%08x)\n", id );
    4649 
    47   status = rtems_semaphore_delete( id );
     50  /*
     51   * This wraps the allocator mutex and should defer any context switching
     52   */
     53  schedsim_set_allow_dispatch(false);
     54    status = rtems_semaphore_delete( id );
     55  schedsim_set_allow_dispatch(true);
     56
    4857  if ( status != RTEMS_SUCCESSFUL ) {
    4958    fprintf(
  • schedsim/shell/shared/schedsim_shell.h

    r8703c13 r187d93c  
     1/**
     2 *  @file
     3 *  @brief Scheduler Simulator Internals
     4 *
     5 *  @note BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
     6 */
     7
    18/*
    2  *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
    3  *
    4  *  COPYRIGHT (c) 1989-2013.
     9 *  COPYRIGHT (c) 1989-2014.
    510 *  On-Line Applications Research Corporation (OAR).
    611 *
     
    3035void PRINT_EXECUTING(void);
    3136void PRINT_HEIR(void);
     37
     38void schedsim_set_allow_dispatch(bool value);
     39bool schedsim_is_dispatch_allowed(void);
    3240
    3341struct rtems_shell_topic_tt;
Note: See TracChangeset for help on using the changeset viewer.