diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2001-01-06 18:08:04 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2001-01-06 18:08:04 +0000 |
commit | f130a170c2917c05702881c0f75d1019aac975e0 (patch) | |
tree | 8041bd50e1d8394f1b7194beb30f43f664cd9462 /gst | |
parent | 45d5c57cb96c7fffe24efadcb6f7a515137cf946 (diff) |
Added a mutex around the mem_chunck alloc routines
Original commit message from CVS:
Added a mutex around the mem_chunck alloc routines
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstbuffer.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index aec08f8382..7091f35432 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -28,12 +28,15 @@ GMemChunk *_gst_buffer_chunk; +GMutex *chunck_lock; void _gst_buffer_initialize (void) { _gst_buffer_chunk = g_mem_chunk_new ("GstBuffer", sizeof(GstBuffer), sizeof(GstBuffer) * 16, G_ALLOC_AND_FREE); + + chunck_lock = g_mutex_new (); } /** @@ -48,7 +51,9 @@ gst_buffer_new(void) { GstBuffer *buffer; + g_mutex_lock (chunck_lock); buffer = g_mem_chunk_alloc (_gst_buffer_chunk); + g_mutex_unlock (chunck_lock); GST_INFO (GST_CAT_BUFFER,"creating new buffer %p",buffer); // g_print("allocating new mutex\n"); @@ -107,7 +112,9 @@ gst_buffer_create_sub (GstBuffer *parent, g_return_val_if_fail (size > 0, NULL); g_return_val_if_fail ((offset+size) <= parent->size, NULL); + g_mutex_lock (chunck_lock); buffer = g_mem_chunk_alloc (_gst_buffer_chunk); + g_mutex_unlock (chunck_lock); GST_INFO (GST_CAT_BUFFER,"creating new subbuffer %p from parent %p", buffer, parent); buffer->lock = g_mutex_new (); @@ -228,7 +235,9 @@ void gst_buffer_destroy (GstBuffer *buffer) //g_print("freed mutex\n"); // remove it entirely from memory + g_mutex_lock (chunck_lock); g_mem_chunk_free (_gst_buffer_chunk,buffer); + g_mutex_unlock (chunck_lock); } /** |