5
Last change
on this file since 57c676c6 was
b4b062f,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/08/16 at 05:50:42
|
rtems: Delete Region_Control::number_of_used_blocks
Use Heap_Statistics::used_blocks instead.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Delete Region |
---|
5 | * @ingroup ClassicRegion |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/rtems/regionimpl.h> |
---|
22 | |
---|
23 | rtems_status_code rtems_region_delete( |
---|
24 | rtems_id id |
---|
25 | ) |
---|
26 | { |
---|
27 | rtems_status_code status; |
---|
28 | Region_Control *the_region; |
---|
29 | |
---|
30 | _Objects_Allocator_lock(); |
---|
31 | |
---|
32 | the_region = _Region_Get_and_lock( id ); |
---|
33 | |
---|
34 | if ( the_region == NULL ) { |
---|
35 | _Objects_Allocator_unlock(); |
---|
36 | return RTEMS_INVALID_ID; |
---|
37 | } |
---|
38 | |
---|
39 | _Heap_Protection_free_all_delayed_blocks( &the_region->Memory ); |
---|
40 | |
---|
41 | if ( the_region->Memory.stats.used_blocks != 0 ) { |
---|
42 | status = RTEMS_RESOURCE_IN_USE; |
---|
43 | } else { |
---|
44 | _Objects_Close( &_Region_Information, &the_region->Object ); |
---|
45 | _Region_Free( the_region ); |
---|
46 | status = RTEMS_SUCCESSFUL; |
---|
47 | } |
---|
48 | |
---|
49 | _Region_Unlock( the_region ); |
---|
50 | _Objects_Allocator_unlock(); |
---|
51 | return status; |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.