Hi Erik,

thanks for responding!

On 03/22/11 08:47, Erik Hofman wrote:
> On Mon, 2011-03-21 at 15:04 +0100, Holger Wirtz wrote:
>> Hi all,
>>
>> sorry - a little bit off-topic (in fact not so much as you might think,
>> it's for a third-party software for FG):
>>
>> Has anyone some hints/websites/programs for debugging C -based multi
>> threaded programs (exactly: glib based C code)? Currently I am
>> developing with vi and a little bit gdb (command line) and very much
>> debug output. But this setup seems to be very frustrating while
>> searching for dead-locks and race-conditions :-(
>
> I have my own locking functions that call the pthread ones and added a
> small piece of code to check for the mutex value:
>
>
> pthread_mutex_t mutex;
> int mtx = mutex.__data.__count;
>
> r = pthread_mutex_lock(&mutex);
> if (mtx != 1) {
>     printf("Mutex was already locked\n");
> }

I tried the same thing with the glib-pthreads wrappers, but 
pthread_mutex_lock blocks until the mutex is unlocked. Perhaps this 
should work with pthread_mutex_trylock()?

> You could add all kinds of fancy stuff using __FILE__, __FUNCTION__ and
> __LINE__ to detect from where the code has been called.
> Note: This only works for __GNUC__

Ok, this seems to be a good way to get more information where the dead 
locks are located. I will try this.

Thanks a lot!

Holger

>
> Erik
>
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to