Re: g_thread_init core dumps called before gtk_init



thomas joseph wrote:

Hi,

I have a gtk application, which calls g_thread_init.
It gives segmentation fault with the call and when I
comment it runs normally.

I am attaching the code below, Could you check what
is
wrong with this code. I have seen in the thread it
fails if you call g_thread_ini after gtk_init but not
this case.

By the way, why are you using gdk_threads_enter/leave pair in
single-threaded application ? This is is the way to hang if you are
using gthread-2.0 with pthreads:

<cut from 'man pthread_mutex_init'>:
   If the mutex is already locked by the calling thread,
the behavior of pthread_mutex_lock depends on the kind of
the mutex. If the mutex is of the `fast'' kind, the calling
thread is suspended until the mutex is unlocked, thus
effectively causing the calling thread to deadlock.
</cut>

The muteces, gthread uses via pthread initialized as default.
Here's what manual says about them:

<cut from 'man pthread_mutex_init'>: The LinuxThreads implementation supports only one mutex
attributes, the mutex kind, which is either `fast'', `recur­sive''
or `error checking''. The kind of a mutex determines whether
it can be locked again by a thread that already owns it.
The default kind is `fast''.
</cut>

Olexiy





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]