comparison audacious/memorypool.c @ 2290:9fc150e3542e trunk

[svn] - add memory_pool_add(): adds a pre-allocated element to a memory pool
author nenolod
date Sun, 07 Jan 2007 00:47:47 -0800
parents 4446a9e7bdee
children 10e07bc9a8c9
comparison
equal deleted inserted replaced
2289:dcac9f84176d 2290:9fc150e3542e
49 pool = g_new0(MemoryPool, 1); 49 pool = g_new0(MemoryPool, 1);
50 pool->notify = notify; 50 pool->notify = notify;
51 pool->mutex = g_mutex_new(); 51 pool->mutex = g_mutex_new();
52 52
53 return pool; 53 return pool;
54 }
55
56 gpointer
57 memory_pool_add(MemoryPool * pool, gpointer ptr)
58 {
59 g_mutex_lock(pool->mutex);
60 pool->stack = g_list_append(pool->stack, addr);
61 g_mutex_unlock(pool->mutex);
62
63 return ptr;
54 } 64 }
55 65
56 gpointer 66 gpointer
57 memory_pool_allocate(MemoryPool * pool, gsize sz) 67 memory_pool_allocate(MemoryPool * pool, gsize sz)
58 { 68 {