source: rtems/cpukit/score/src/objectfree.c @ 80cf60e

5
Last change on this file since 80cf60e was 80cf60e, checked in by Sebastian Huber <sebastian.huber@…>, on 04/15/20 at 07:48:32

Canonicalize config.h include

Use the following variant which was already used by most source files:

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Free Object
5 *  @ingroup RTEMSScoreObject
6 */
7
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
24void _Objects_Free_unlimited(
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}
Note: See TracBrowser for help on using the repository browser.