Changeset 474b9be in rtems


Ignore:
Timestamp:
Mar 15, 2016, 2:42:57 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
f2f207ce
Parents:
05ef287
git-author:
Sebastian Huber <sebastian.huber@…> (03/15/16 14:42:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/16/16 06:16:58)
Message:

score: Use allocator lock in _Objects_Get_next()

Use the object allocator lock in _Objects_Get_next() instead of disabled
thread dispatching since object creation and deletion is covered by this
lock.

Update #2555.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/objectimpl.h

    r05ef287 r474b9be  
    615615
    616616/**
    617  *  Like @ref _Objects_Get, but is used to find "next" open object.
     617 *  Like @ref _Objects_Get, but is used to find "next" open
     618 *  object.
     619 *
     620 *  Locks the object allocator mutex in case a next object exists.
    618621 *
    619622 *  @param[in] information points to an object class information block.
  • cpukit/score/src/objectgetnext.c

    r05ef287 r474b9be  
    2020
    2121#include <rtems/score/objectimpl.h>
    22 
    23 /*
    24  * _Objects_Get_next
    25  *
    26  * Like _Objects_Get, but considers the 'id' as a "hint" and
    27  * finds next valid one after that point.
    28  * Mostly used for monitor and debug traversal of an object.
    29  *
    30  * Input parameters:
    31  *   information - pointer to entry in table for this class
    32  *   id          - object id to search for
    33  *   location    - address of where to store the location
    34  *   next_id     - address to store next id to try
    35  *
    36  * Output parameters:
    37  *   returns     - address of object if local
    38  *   location    - one of the following:
    39  *                  OBJECTS_ERROR  - invalid object ID
    40  *                  OBJECTS_REMOTE - remote object
    41  *                  OBJECTS_LOCAL  - local object
    42  *   next_id     - will contain a reasonable "next" id to continue traversal
    43  *
    44  * NOTE:
    45  *      assumes can add '1' to an id to get to next index.
    46  */
    4722
    4823Objects_Control *
     
    7146        next_id = id;
    7247
     48    _Objects_Allocator_lock();
     49
    7350    do {
    7451        /* walked off end of list? */
    7552        if (_Objects_Get_index(next_id) > information->maximum)
    7653        {
     54            _Objects_Allocator_unlock();
    7755            *location_p = OBJECTS_ERROR;
    78             goto final;
     56            *next_id_p = OBJECTS_ID_FINAL;
     57            return NULL;
    7958        }
    8059
    8160        /* try to grab one */
    82         object = _Objects_Get(information, next_id, location_p);
     61        object = _Objects_Get_no_protection(information, next_id, location_p);
    8362
    8463        next_id++;
     
    8867    *next_id_p = next_id;
    8968    return object;
    90 
    91 final:
    92     *next_id_p = OBJECTS_ID_FINAL;
    93     return 0;
    9469}
  • testsuites/sptests/spobjgetnext/init.c

    r05ef287 r474b9be  
    5454      break;
    5555    /* XXX check dispatch level with macros */
    56 
    57     _Thread_Enable_dispatch();
    5856
    5957    /* XXX should be able to check that next Id is not one we have seen */
Note: See TracChangeset for help on using the changeset viewer.