source: rtems/cpukit/libcsupport/src/malloc_deferred.c @ 3b978e19

4.11
Last change on this file since 3b978e19 was 3b978e19, checked in by Sebastian Huber <sebastian.huber@…>, on Aug 9, 2012 at 8:36:25 AM

libcsupport: malloc_deferred_frees_initialize()

Remove this function and statically initialize RTEMS_Malloc_GC_list.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/*
2 *  Process free requests deferred because they were from ISR
3 *  or other critical section.
4 *
5 *  COPYRIGHT (c) 1989-2007.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 */
12
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#ifdef RTEMS_NEWLIB
18#include <stdlib.h>
19#include <errno.h>
20
21#include "malloc_p.h"
22
23RTEMS_CHAIN_DEFINE_EMPTY(RTEMS_Malloc_GC_list);
24
25bool malloc_is_system_state_OK(void)
26{
27  if ( _Thread_Dispatch_in_critical_section() )
28    return false;
29
30  if ( _ISR_Nest_level > 0 )
31    return false;
32
33  return true;
34}
35
36void malloc_deferred_frees_process(void)
37{
38  rtems_chain_node  *to_be_freed;
39
40  /*
41   *  If some free's have been deferred, then do them now.
42   */
43  while ((to_be_freed = rtems_chain_get(&RTEMS_Malloc_GC_list)) != NULL)
44    free(to_be_freed);
45}
46
47void malloc_deferred_free(
48  void *pointer
49)
50{
51  rtems_chain_append(&RTEMS_Malloc_GC_list, (rtems_chain_node *)pointer);
52}
53#endif
Note: See TracBrowser for help on using the repository browser.