1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Non-sleeping memory allocation
5 * This file is part of gmidimonitor
7 * Copyright (C) 2006,2007,2008 Nedko Arnaudov <nedko@arnaudov.name>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 *****************************************************************************/
24 #ifndef MEMORY_ATOMIC_H__7B572547_304D_4597_8808_990BE4476CC3__INCLUDED
25 #define MEMORY_ATOMIC_H__7B572547_304D_4597_8808_990BE4476CC3__INCLUDED
31 } /* Adjust editor indent */
34 typedef void * rtsafe_memory_pool_handle
;
38 rtsafe_memory_pool_create(
39 size_t data_size
, /* chunk size */
40 size_t min_preallocated
, /* min chunks preallocated */
41 size_t max_preallocated
, /* max chunks preallocated */
42 rtsafe_memory_pool_handle
* pool_ptr
);
46 rtsafe_memory_pool_destroy(
47 rtsafe_memory_pool_handle pool
);
51 rtsafe_memory_pool_sleepy(
52 rtsafe_memory_pool_handle pool
);
54 /* will not sleep, returns NULL if no memory is available */
56 rtsafe_memory_pool_allocate(
57 rtsafe_memory_pool_handle pool
);
59 /* may sleep, returns NULL if no memory is available */
61 rtsafe_memory_pool_allocate(
62 rtsafe_memory_pool_handle pool
);
66 rtsafe_memory_pool_allocate_sleepy(
67 rtsafe_memory_pool_handle pool
);
71 rtsafe_memory_pool_deallocate(
72 rtsafe_memory_pool_handle pool
,
75 typedef void * rtsafe_memory_handle
;
83 rtsafe_memory_handle
* handle_ptr
);
87 rtsafe_memory_allocate(
88 rtsafe_memory_handle handle_ptr
,
93 rtsafe_memory_handle handle_ptr
);
97 rtsafe_memory_deallocate(
101 rtsafe_memory_uninit(
102 rtsafe_memory_handle handle_ptr
);
105 { /* Adjust editor indent */
111 #endif /* #ifndef MEMORY_ATOMIC_H__7B572547_304D_4597_8808_990BE4476CC3__INCLUDED */