README: Fix adjust homepage URL
[gmidimonitor.git] / memory_atomic.h
blobae86118b46d84c3aa7b82d2eab502ac1560cdf50
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,2011 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
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 #if 0
31 } /* Adjust editor indent */
32 #endif
34 typedef void * rtsafe_memory_pool_handle;
36 /* will sleep */
37 gboolean
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);
44 /* will sleep */
45 void
46 rtsafe_memory_pool_destroy(
47 rtsafe_memory_pool_handle pool);
49 /* may sleep */
50 void
51 rtsafe_memory_pool_sleepy(
52 rtsafe_memory_pool_handle pool);
54 /* will not sleep, returns NULL if no memory is available */
55 void *
56 rtsafe_memory_pool_allocate(
57 rtsafe_memory_pool_handle pool);
59 /* may sleep, returns NULL if no memory is available */
60 void *
61 rtsafe_memory_pool_allocate(
62 rtsafe_memory_pool_handle pool);
64 /* may sleep */
65 void *
66 rtsafe_memory_pool_allocate_sleepy(
67 rtsafe_memory_pool_handle pool);
69 /* will not sleep */
70 void
71 rtsafe_memory_pool_deallocate(
72 rtsafe_memory_pool_handle pool,
73 void * data);
75 typedef void * rtsafe_memory_handle;
77 /* will sleep */
78 gboolean
79 rtsafe_memory_init(
80 size_t max_size,
81 size_t prealloc_min,
82 size_t prealloc_max,
83 rtsafe_memory_handle * handle_ptr);
85 /* will not sleep */
86 void *
87 rtsafe_memory_allocate(
88 rtsafe_memory_handle handle_ptr,
89 size_t size);
91 void
92 rtsafe_memory_sleepy(
93 rtsafe_memory_handle handle_ptr);
95 /* will not sleep */
96 void
97 rtsafe_memory_deallocate(
98 void * data);
100 void
101 rtsafe_memory_uninit(
102 rtsafe_memory_handle handle_ptr);
104 #if 0
105 { /* Adjust editor indent */
106 #endif
107 #ifdef __cplusplus
108 } /* extern "C" */
109 #endif
111 #endif /* #ifndef MEMORY_ATOMIC_H__7B572547_304D_4597_8808_990BE4476CC3__INCLUDED */