xref: /haiku/headers/os/media/RealtimeAlloc.h (revision f6e4cbb95290a74b33d012600438b84742b0e572)
152a38012Sejakowatz /*******************************************************************************
252a38012Sejakowatz /
352a38012Sejakowatz /	File:			RealtimeAlloc.h
452a38012Sejakowatz /
552a38012Sejakowatz /   Description:    Allocation from separate "pools" of memory. Those pools
652a38012Sejakowatz /					will be locked in RAM if realtime allocators are turned
752a38012Sejakowatz /					on in the BMediaRoster, so don't waste this memory unless
852a38012Sejakowatz /					it's needed. Also, the shared pool is a scarce resource,
952a38012Sejakowatz /					so it's better if you create your own pool for your own
1052a38012Sejakowatz /					needs and leave the shared pool for BMediaNode instances
1152a38012Sejakowatz /					and the needs of the Media Kit.
1252a38012Sejakowatz /
1352a38012Sejakowatz /	Copyright 1998-99, Be Incorporated, All Rights Reserved
1452a38012Sejakowatz /
1552a38012Sejakowatz *******************************************************************************/
1652a38012Sejakowatz 
1752a38012Sejakowatz #if !defined(_REALTIME_ALLOC_H)
1852a38012Sejakowatz #define _REALTIME_ALLOC_H
1952a38012Sejakowatz 
2052a38012Sejakowatz #include <SupportDefs.h>
2152a38012Sejakowatz 
2252a38012Sejakowatz #if defined(__cplusplus)
2352a38012Sejakowatz extern "C" {
2452a38012Sejakowatz #endif
2552a38012Sejakowatz 
2652a38012Sejakowatz typedef struct rtm_pool rtm_pool;
2752a38012Sejakowatz 
2852a38012Sejakowatz /* If out_pool is NULL, the default pool will be created if it isn't already. */
2952a38012Sejakowatz /* If the default pool is already created, it will return EALREADY. */
3052a38012Sejakowatz #if defined(__cplusplus)
31*f6e4cbb9SAxel Dörfler status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * name=NULL);
3252a38012Sejakowatz #else
33*f6e4cbb9SAxel Dörfler status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * name);
3452a38012Sejakowatz #endif
35*f6e4cbb9SAxel Dörfler status_t rtm_delete_pool(rtm_pool * pool);
3652a38012Sejakowatz /* If NULL is passed for pool, the default pool is used (if created). */
37*f6e4cbb9SAxel Dörfler void * rtm_alloc(rtm_pool * pool, size_t size);
38*f6e4cbb9SAxel Dörfler status_t rtm_free(void * data);
39*f6e4cbb9SAxel Dörfler status_t rtm_realloc(void ** data, size_t new_size);
40*f6e4cbb9SAxel Dörfler status_t rtm_size_for(void * data);
41*f6e4cbb9SAxel Dörfler status_t rtm_phys_size_for(void * data);
4252a38012Sejakowatz 
4352a38012Sejakowatz /* Return the default pool, or NULL if not yet initialized */
44*f6e4cbb9SAxel Dörfler rtm_pool * rtm_default_pool();
4552a38012Sejakowatz 
4652a38012Sejakowatz #if defined(__cplusplus)
4752a38012Sejakowatz }
4852a38012Sejakowatz #endif
4952a38012Sejakowatz 
5052a38012Sejakowatz #endif // _REALTIME_ALLOC_H
5152a38012Sejakowatz 
52