Possible bug in cpukit/score/src/objectgetbyindex.c
Joel Sherrill
joel.sherrill at OARcorp.com
Tue Jun 15 12:42:49 UTC 2010
On 06/15/2010 06:44 AM, Wendell Pereira da Silva wrote:
>
> Hi,
>
> Is this code correct? I think a call to _Thread_Enable_dispatch() is
> missing (as indicated below).
>
I am happy to say yes it is. All _Objects_Get variation
return with thread dispatching disabled if the object
is local and exists. The converts the id to a pointer
and puts you in a critical section as an atomic
operation. It is the responsibility of the caller to
enable dispatch before returning.
See something like tasksetnote.c for a simple
example of the pattern.
>
> Objects_Control *_Objects_Get_by_index(
>
> Objects_Information *information,
>
> uint32_t index,
>
> Objects_Locations *location
>
> )
>
> {
>
> Objects_Control *the_object;
>
> if ( information->maximum >= index ) {
>
> *_Thread_Disable_dispatch(); *
>
> the_object = information->local_table[ index ];
>
> if ( the_object ) {
>
> *location = OBJECTS_LOCAL;
>
> * [***** Is a call to _Thread_Enable_dispatch() missing here? ****]*
>
> return( the_object );
>
> }
>
> *_Thread_Enable_dispatch();*
>
> *location = OBJECTS_ERROR;
>
> return( NULL );
>
> }
>
> Regards,
>
> Wendell.
>
More information about the users
mailing list