Re: Using GAllocator in a multi-threaded environment
Owen Taylor <[email protected]> 16 Apr 2003 02:19:54 -0400
| Newsgroups | gmane.comp.gnome.lib.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2003-03-11 at 09:54, Beni Serfaty wrote:
> Hi,
>
> I was happily using GQueue which seemed to be doing it's job right. When
> I applied another GQueue running from a different thread, I started
> getting sometime segmentation fault from the function _g_list_alloc -
> (In the line current_allocator->free_lists->data = list->next; )
>
> I didn't use GAllocator with any of the GQueue (actually, didn't use
> this functionality at all). I am using GLib 2.0
>
> I would like to know:
> How do one work with GQueue in a multi-threaded environment:
> (I want to use several GQueues or GLists, with different GAllocators,
> running in a multi-threaded environment). Since the current allocator is
> static in the lib code, is it even possible without locking? Is there
> some way to use a non-static allocator?
GQueue should be doing the locking for you, and I believe it does.
My *guess* (not discounting the possibility of a GLib bug, but doubting
it) is that something else is buggy elsewhere in your program.
Regards,
Owen