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.
This commit is contained in:
Sebastian Huber
2016-03-15 15:42:57 +01:00
parent 05ef28754e
commit 474b9beeaa
3 changed files with 10 additions and 34 deletions

View File

@@ -614,7 +614,10 @@ Objects_Control *_Objects_Get_no_protection(
);
/**
* Like @ref _Objects_Get, but is used to find "next" open object.
* Like @ref _Objects_Get, but is used to find "next" open
* object.
*
* Locks the object allocator mutex in case a next object exists.
*
* @param[in] information points to an object class information block.
* @param[in] id is the Id of the object whose name we are locating.

View File

@@ -20,31 +20,6 @@
#include <rtems/score/objectimpl.h>
/*
* _Objects_Get_next
*
* Like _Objects_Get, but considers the 'id' as a "hint" and
* finds next valid one after that point.
* Mostly used for monitor and debug traversal of an object.
*
* Input parameters:
* information - pointer to entry in table for this class
* id - object id to search for
* location - address of where to store the location
* next_id - address to store next id to try
*
* Output parameters:
* returns - address of object if local
* location - one of the following:
* OBJECTS_ERROR - invalid object ID
* OBJECTS_REMOTE - remote object
* OBJECTS_LOCAL - local object
* next_id - will contain a reasonable "next" id to continue traversal
*
* NOTE:
* assumes can add '1' to an id to get to next index.
*/
Objects_Control *
_Objects_Get_next(
Objects_Information *information,
@@ -70,16 +45,20 @@ _Objects_Get_next(
else
next_id = id;
_Objects_Allocator_lock();
do {
/* walked off end of list? */
if (_Objects_Get_index(next_id) > information->maximum)
{
_Objects_Allocator_unlock();
*location_p = OBJECTS_ERROR;
goto final;
*next_id_p = OBJECTS_ID_FINAL;
return NULL;
}
/* try to grab one */
object = _Objects_Get(information, next_id, location_p);
object = _Objects_Get_no_protection(information, next_id, location_p);
next_id++;
@@ -87,8 +66,4 @@ _Objects_Get_next(
*next_id_p = next_id;
return object;
final:
*next_id_p = OBJECTS_ID_FINAL;
return 0;
}

View File

@@ -54,8 +54,6 @@ int scan_objects(
break;
/* XXX check dispatch level with macros */
_Thread_Enable_dispatch();
/* XXX should be able to check that next Id is not one we have seen */
}
return i;