RTEMS
objectfree.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-1999.
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 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include <rtems/score/objectimpl.h>
22 #include <rtems/score/chainimpl.h>
23 
25  Objects_Information *information,
26  Objects_Control *the_object
27 )
28 {
29  _Chain_Append_unprotected( &information->Inactive, &the_object->Node );
30 
31  if ( _Objects_Is_auto_extend( information ) ) {
32  Objects_Maximum objects_per_block;
33  Objects_Maximum block;
34  Objects_Maximum inactive;
35 
36  objects_per_block = information->objects_per_block;
37  block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM;
38 
39  if ( block > objects_per_block ) {
40  block /= objects_per_block;
41 
42  ++information->inactive_per_block[ block ];
43 
44  inactive = information->inactive;
45  ++inactive;
46  information->inactive = inactive;
47 
48  /*
49  * Check if the threshold level has been met of
50  * 1.5 x objects_per_block are free.
51  */
52 
53  if ( inactive > ( objects_per_block + ( objects_per_block >> 1 ) ) ) {
54  _Objects_Shrink_information( information );
55  }
56  }
57  }
58 }
void _Objects_Shrink_information(Objects_Information *information)
Shrinks an object class information record.
void _Objects_Free_unlimited(Objects_Information *information, Objects_Control *the_object)
Free the object.
Definition: objectfree.c:24
#define OBJECTS_INDEX_MINIMUM
Definition: objectimpl.h:80
Chain_Control Inactive
This is the chain of inactive object control blocks.
Definition: objectdata.h:256
uint16_t Objects_Maximum
Definition: object.h:86
Objects_Maximum * inactive_per_block
This is the number of inactive object control blocks per allocation block.
Definition: objectdata.h:264
static __inline__ Objects_Maximum _Objects_Get_index(Objects_Id id)
Returns the index portion of the ID.
Definition: object.h:298
Objects_Maximum inactive
This is the number of object control blocks on the inactive chain.
Definition: objectdata.h:222
static __inline__ void _Chain_Append_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Appends a node (unprotected).
Definition: chainimpl.h:680
Inlined Routines in the Object Handler.
Chain_Node Node
Definition: objectdata.h:41
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
Chain Handler API.
Objects_Maximum objects_per_block
This is the number of object control blocks in an allocation block.
Definition: objectdata.h:231
static __inline__ Objects_Maximum _Objects_Is_auto_extend(const Objects_Information *information)
Checks if the automatic object extension (unlimited objects) is enabled.
Definition: objectimpl.h:671
Objects_Id id
Definition: objectdata.h:43