Changeset f4d541cc in rtems


Ignore:
Timestamp:
Apr 27, 2016, 2:46:57 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
7772640
Parents:
f009ed0
git-author:
Sebastian Huber <sebastian.huber@…> (04/27/16 14:46:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/02/16 05:46:15)
Message:

rtems: Avoid Giant lock in rtems_object_set_name()

Update #2555.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/src/rtemsobjectsetname.c

    rf009ed0 rf4d541cc  
    2020
    2121#include <rtems/rtems/object.h>
     22#include <rtems/rtems/tasks.h>
    2223#include <rtems/score/objectimpl.h>
    23 #include <rtems/score/thread.h>
    2424
    2525/*
     
    3434{
    3535  Objects_Information *information;
    36   Objects_Locations    location;
    3736  Objects_Control     *the_object;
    3837  Objects_Id           tmpId;
     
    4140    return RTEMS_INVALID_ADDRESS;
    4241
    43   tmpId = (id == OBJECTS_ID_OF_SELF) ? _Thread_Get_executing()->Object.id : id;
     42  tmpId = (id == OBJECTS_ID_OF_SELF) ? rtems_task_self() : id;
    4443
    4544  information  = _Objects_Get_information_id( tmpId );
     
    4746    return RTEMS_INVALID_ID;
    4847
    49   the_object = _Objects_Get( information, tmpId, &location );
    50   switch ( location ) {
     48  _Objects_Allocator_lock();
     49  the_object = _Objects_Get_no_protection( tmpId, information );
    5150
    52     case OBJECTS_LOCAL:
    53       _Objects_Set_name( information, the_object, name );
    54       _Objects_Put( the_object );
    55       return RTEMS_SUCCESSFUL;
    56 
    57 #if defined(RTEMS_MULTIPROCESSING)
    58     case OBJECTS_REMOTE:
    59 #endif
    60     case OBJECTS_ERROR:
    61       break;
     51  if ( the_object == NULL ) {
     52    _Objects_Allocator_unlock();
     53    return RTEMS_INVALID_ID;
    6254  }
    6355
    64   return RTEMS_INVALID_ID;
     56  _Objects_Set_name( information, the_object, name );
     57  _Objects_Allocator_unlock();
     58  return RTEMS_SUCCESSFUL;
    6559}
Note: See TracChangeset for help on using the changeset viewer.