diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-24 15:57:29 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-24 16:00:26 +0100 |
commit | 2a713e3b944625c45154f0ea7f5703e918de758b (patch) | |
tree | c572bfa9e000f7e1fd815d2ab698ac27abf70e7d /cpukit/score/include/rtems/score/heapimpl.h | |
parent | libcsupport: Use POSIX keys for GXX key functions (diff) | |
download | rtems-2a713e3b944625c45154f0ea7f5703e918de758b.tar.bz2 |
score: _Heap_Protection_set_delayed_free_fraction
Add and use _Heap_Protection_set_delayed_free_fraction(). This makes it
possible to avoid a dependency on _Thread_Dispatch_is_enabled().
Diffstat (limited to 'cpukit/score/include/rtems/score/heapimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/heapimpl.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/heapimpl.h b/cpukit/score/include/rtems/score/heapimpl.h index abc573de19..a8948edd6f 100644 --- a/cpukit/score/include/rtems/score/heapimpl.h +++ b/cpukit/score/include/rtems/score/heapimpl.h @@ -347,6 +347,29 @@ Heap_Block *_Heap_Block_allocate( } #endif +/** + * @brief Sets the fraction of delayed free blocks that is actually freed + * during memory shortage. + * + * The default is to free half the delayed free blocks. This is equal to a + * fraction value of two. + * + * @param[in] heap The heap control. + * @param[in] fraction The fraction is one divided by this fraction value. + */ +RTEMS_INLINE_ROUTINE void _Heap_Protection_set_delayed_free_fraction( + Heap_Control *heap, + uintptr_t fraction +) +{ +#ifdef HEAP_PROTECTION + heap->Protection.delayed_free_fraction = fraction; +#else + (void) heap; + (void) fraction; +#endif +} + RTEMS_INLINE_ROUTINE Heap_Block *_Heap_Free_list_head( Heap_Control *heap ) { return &heap->free_list; |