Re: glib memory allocation problems
- From: Tim Janik <timj imendio com>
- To: Miklos Szeredi <miklos szeredi hu>
- Cc: jimis gmx net, Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: glib memory allocation problems
- Date: Tue, 15 May 2007 17:55:29 +0200 (CEST)
On Tue, 15 May 2007, Miklos Szeredi wrote:
So the question is, should glib not make some sanity checking for code
that is not actually thread related (like gslice).
it does do sanity checking, it throws a big bold warning if you call
thread_init and gslice in the wrong order:
But if g_thread_init() was not called _at all_, it just silently
corrupts the data structures.
no, gslice works perfectly fine in a single threaded program.
And this is perfectly possible if program is using the pthread API,
while using glib for hash tables, etc.
if you use the pthread API without calling g_thread_init(), you're getting
yourself into trouble. don't do that, glib can't possibly work correctly
in threaded scenarios without its threading system being initialized.
Probably this situation is not even so rare, and other programs may be
suffering from this same problem, without being aware of it.
] [Thread Prev