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

4.115
Last change on this file since 3b978e19 was 3b978e19, checked in by Sebastian Huber <sebastian.huber@…>, on 08/09/12 at 08:36:25

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
RevLine 
[8e30a269]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
[3b978e19]23RTEMS_CHAIN_DEFINE_EMPTY(RTEMS_Malloc_GC_list);
[635865ae]24
[4088d01d]25bool malloc_is_system_state_OK(void)
[8e30a269]26{
[d7c3883]27  if ( _Thread_Dispatch_in_critical_section() )
[4088d01d]28    return false;
[8e30a269]29
30  if ( _ISR_Nest_level > 0 )
[4088d01d]31    return false;
[8e30a269]32
[4088d01d]33  return true;
[8e30a269]34}
35
[635865ae]36void malloc_deferred_frees_process(void)
[8e30a269]37{
[72d2ec4d]38  rtems_chain_node  *to_be_freed;
[8e30a269]39
40  /*
41   *  If some free's have been deferred, then do them now.
42   */
[72d2ec4d]43  while ((to_be_freed = rtems_chain_get(&RTEMS_Malloc_GC_list)) != NULL)
[8e30a269]44    free(to_be_freed);
45}
46
[635865ae]47void malloc_deferred_free(
[8e30a269]48  void *pointer
49)
50{
[72d2ec4d]51  rtems_chain_append(&RTEMS_Malloc_GC_list, (rtems_chain_node *)pointer);
[8e30a269]52}
53#endif
Note: See TracBrowser for help on using the repository browser.