Re: problems with threads in a shared object



gdb:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1218409552 (LWP 25125)]
0xb7979e84 in pthread_mutex_lock () from /lib/tls/i686/cmov/libpthread.so.0

There's a plugin_register() function that initializes g_thread (the main
program also init's it) and the mutex is also allocated before used.


On 8/8/06, Tristan Van Berkom <tvb gnome org> wrote:

Luka Napotnik wrote:
> I have a program that imports plugins via dlopen and dlsym(). In those
> plugins I use functions like g_mutex_lock to lock a variable, declared
in
> the main program. But when getting to the mutex function the whole
program
> crashes.
> The .so library is compiled with:
>
> gcc -g -O0 -shared `pkg-config --libs --cflags gtk+-2.0 glib-2.0
> gthread-2.0` rr.c -o rr.so
>
> What's wrong?

Good question, did you initialize the threading library ? what did the
stack trace clue you into ? what was the state of the mutex variable
when you attempted to lock it ? unlocked, locked... uncreated ?

Cheers,
                    -Tristan




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