Changeset c11ca814 in rtems for cpukit/libcsupport/src/malloc.c


Ignore:
Timestamp:
Nov 26, 2003, 5:51:00 PM (16 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
294daf49
Parents:
86042ae
Message:

2003-11-26 Joel Sherrill <joel@…>

PR 523/filesystem

  • src/malloc.c: Make malloc family safer for use from ISRs and dispatching critical sections. If in a critical section while doing a free(), then the free is deferred until the next malloc() attempt.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/malloc.c

    r86042ae rc11ca814  
    171171   */
    172172
    173   if (_Thread_Dispatch_disable_level > 0)
    174     return (void *) 0;
    175  
    176   if (_ISR_Nest_level > 0)
    177     return (void *) 0;
     173  if (_System_state_Is_up(_System_state_Get())) {
     174    if (_Thread_Dispatch_disable_level > 0)
     175      return (void *) 0;
     176 
     177    if (_ISR_Nest_level > 0)
     178      return (void *) 0;
     179  }
    178180 
    179181  /*
     
    298300   */
    299301
    300   if (_Thread_Dispatch_disable_level > 0)
    301     return (void *) 0;
    302  
    303   if (_ISR_Nest_level > 0)
    304     return (void *) 0;
     302  if (_System_state_Is_up(_System_state_Get())) {
     303    if (_Thread_Dispatch_disable_level > 0)
     304      return (void *) 0;
     305 
     306    if (_ISR_Nest_level > 0)
     307      return (void *) 0;
     308  }
    305309 
    306310  /*
     
    357361   */
    358362
    359   if ((_Thread_Dispatch_disable_level > 0) || (_ISR_Nest_level > 0)) {
    360     Chain_Append(&RTEMS_Malloc_GC_list, (Chain_Node *)ptr);
    361     return;
     363  if (_System_state_Is_up(_System_state_Get())) {
     364    if ((_Thread_Dispatch_disable_level > 0) || (_ISR_Nest_level > 0)) {
     365      Chain_Append(&RTEMS_Malloc_GC_list, (Chain_Node *)ptr);
     366      return;
     367    }
    362368  }
    363369 
Note: See TracChangeset for help on using the changeset viewer.