diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-04 10:13:35 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-06 09:08:22 +0200 |
commit | 3570ec684f23dc57772856d1170d39252299a490 (patch) | |
tree | 9729d0ff751ec562e68a99dfb62e1f60de5e1f0c /cpukit/rtems/src/partdelete.c | |
parent | score: Use red-black tree for active global objects (diff) | |
download | rtems-3570ec684f23dc57772856d1170d39252299a490.tar.bz2 |
rtems: Avoid Giant lock for partitions
Use an ISR lock to protect the partition state changes.
Update #2555.
Diffstat (limited to 'cpukit/rtems/src/partdelete.c')
-rw-r--r-- | cpukit/rtems/src/partdelete.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cpukit/rtems/src/partdelete.c b/cpukit/rtems/src/partdelete.c index 032f73d3d0..2df3893b77 100644 --- a/cpukit/rtems/src/partdelete.c +++ b/cpukit/rtems/src/partdelete.c @@ -20,20 +20,22 @@ #include <rtems/rtems/partimpl.h> #include <rtems/rtems/attrimpl.h> -#include <rtems/score/threaddispatch.h> rtems_status_code rtems_partition_delete( rtems_id id ) { - Partition_Control *the_partition; - Objects_Locations location; + Partition_Control *the_partition; + Objects_Locations location; + ISR_lock_Context lock_context; _Objects_Allocator_lock(); - the_partition = _Partition_Get( id, &location ); + the_partition = _Partition_Get( id, &location, &lock_context ); switch ( location ) { case OBJECTS_LOCAL: + _Partition_Acquire_critical( the_partition, &lock_context ); + if ( the_partition->number_of_used_blocks == 0 ) { _Objects_Close( &_Partition_Information, &the_partition->Object ); #if defined(RTEMS_MULTIPROCESSING) @@ -53,12 +55,14 @@ rtems_status_code rtems_partition_delete( } #endif - _Objects_Put( &the_partition->Object ); + _Partition_Release( the_partition, &lock_context ); + _Partition_Destroy( the_partition ); _Partition_Free( the_partition ); _Objects_Allocator_unlock(); return RTEMS_SUCCESSFUL; } - _Objects_Put( &the_partition->Object ); + + _Partition_Release( the_partition, &lock_context ); _Objects_Allocator_unlock(); return RTEMS_RESOURCE_IN_USE; |