diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-01-03 07:19:47 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-12 09:08:41 +0100 |
commit | fc32904f4a270976961d61385be44c56fcc6fd01 (patch) | |
tree | d170993186878f2e3a38a007eadd068203556dcf /cpukit/include/rtems/score/objectimpl.h | |
parent | score: Add _Objects_Activate_unlimited() (diff) | |
download | rtems-fc32904f4a270976961d61385be44c56fcc6fd01.tar.bz2 |
score: Add _Objects_Allocate_with_extend()
Update #3835.
Diffstat (limited to 'cpukit/include/rtems/score/objectimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/objectimpl.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h index e0fd7882c2..5ade0edc5a 100644 --- a/cpukit/include/rtems/score/objectimpl.h +++ b/cpukit/include/rtems/score/objectimpl.h @@ -967,6 +967,38 @@ RTEMS_INLINE_ROUTINE void _Objects_Activate_unlimited( } } +/** + * @brief Allocate an object and extend the objects information on demand. + * + * This function must be only used in case this objects information supports + * unlimited objects. + * + * @param information The object information block. + * @param extend The object information extend handler. + */ +RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Allocate_with_extend( + Objects_Information *information, + void ( *extend )( Objects_Information * ) +) +{ + Objects_Control *the_object; + + _Assert( _Objects_Is_auto_extend( information ) ); + + the_object = _Objects_Get_inactive( information ); + + if ( the_object == NULL ) { + ( *extend )( information ); + the_object = _Objects_Get_inactive( information ); + } + + if ( the_object != NULL ) { + _Objects_Activate_unlimited( information, the_object ); + } + + return the_object; +} + /** @} */ #ifdef __cplusplus |