xref: /haiku/headers/os/media/RealtimeAlloc.h (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
1 /*******************************************************************************
2 /
3 /	File:			RealtimeAlloc.h
4 /
5 /   Description:    Allocation from separate "pools" of memory. Those pools
6 /					will be locked in RAM if realtime allocators are turned
7 /					on in the BMediaRoster, so don't waste this memory unless
8 /					it's needed. Also, the shared pool is a scarce resource,
9 /					so it's better if you create your own pool for your own
10 /					needs and leave the shared pool for BMediaNode instances
11 /					and the needs of the Media Kit.
12 /
13 /	Copyright 1998-99, Be Incorporated, All Rights Reserved
14 /
15 *******************************************************************************/
16 
17 #if !defined(_REALTIME_ALLOC_H)
18 #define _REALTIME_ALLOC_H
19 
20 #include <SupportDefs.h>
21 
22 #if defined(__cplusplus)
23 extern "C" {
24 #endif
25 
26 typedef struct rtm_pool rtm_pool;
27 
28 /* If out_pool is NULL, the default pool will be created if it isn't already. */
29 /* If the default pool is already created, it will return EALREADY. */
30 #if defined(__cplusplus)
31 status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * name=NULL);
32 #else
33 status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * name);
34 #endif
35 status_t rtm_delete_pool(rtm_pool * pool);
36 /* If NULL is passed for pool, the default pool is used (if created). */
37 void * rtm_alloc(rtm_pool * pool, size_t size);
38 status_t rtm_free(void * data);
39 status_t rtm_realloc(void ** data, size_t new_size);
40 status_t rtm_size_for(void * data);
41 status_t rtm_phys_size_for(void * data);
42 
43 /* Return the default pool, or NULL if not yet initialized */
44 rtm_pool * rtm_default_pool();
45 
46 #if defined(__cplusplus)
47 }
48 #endif
49 
50 #endif // _REALTIME_ALLOC_H
51 
52