source:
rtems/cpukit/score/src/objectfree.c
@
21275b58
Last change on this file since 21275b58 was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on 11/22/18 at 18:14:51 | |
---|---|
|
|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[e0f91da] | 1 | /** |
2 | * @file | |
[317a5b5] | 3 | * |
[e0f91da] | 4 | * @brief Free Object |
5 | * @ingroup ScoreObject | |
6 | */ | |
7 | ||
8 | /* | |
[08311cc3] | 9 | * COPYRIGHT (c) 1989-1999. |
[317a5b5] | 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 | |
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
[317a5b5] | 15 | */ |
16 | ||
[a8eed23] | 17 | #if HAVE_CONFIG_H |
18 | #include "config.h" | |
19 | #endif | |
20 | ||
[a2e3f33] | 21 | #include <rtems/score/objectimpl.h> |
[23fec9f0] | 22 | #include <rtems/score/assert.h> |
[6e93dc4a] | 23 | #include <rtems/score/chainimpl.h> |
[317a5b5] | 24 | |
25 | void _Objects_Free( | |
26 | Objects_Information *information, | |
27 | Objects_Control *the_object | |
28 | ) | |
29 | { | |
[6c2b8a4b] | 30 | _Assert( _Objects_Allocator_is_owner() ); |
[23fec9f0] | 31 | |
32 | _Chain_Append_unprotected( &information->Inactive, &the_object->Node ); | |
[317a5b5] | 33 | |
[8b0e752f] | 34 | if ( _Objects_Is_auto_extend( information ) ) { |
[359a3a3] | 35 | Objects_Maximum objects_per_block; |
36 | Objects_Maximum block; | |
37 | Objects_Maximum inactive; | |
38 | ||
39 | objects_per_block = information->objects_per_block; | |
[3899bc1a] | 40 | block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; |
[05279b84] | 41 | |
[21275b58] | 42 | if ( block > objects_per_block ) { |
43 | block /= objects_per_block; | |
[05279b84] | 44 | |
[21275b58] | 45 | ++information->inactive_per_block[ block ]; |
[05279b84] | 46 | |
[21275b58] | 47 | inactive = information->inactive; |
48 | ++inactive; | |
49 | information->inactive = inactive; | |
[317a5b5] | 50 | |
[21275b58] | 51 | /* |
52 | * Check if the threshold level has been met of | |
53 | * 1.5 x objects_per_block are free. | |
54 | */ | |
55 | ||
56 | if ( inactive > ( objects_per_block + ( objects_per_block >> 1 ) ) ) { | |
57 | _Objects_Shrink_information( information ); | |
58 | } | |
[317a5b5] | 59 | } |
60 | } | |
61 | } |
Note: See TracBrowser
for help on using the repository browser.