So... I was investigating a mutex inter-lock situation and found it really
useful to add a new member to the "dt_pthread_mutex_t" structure to hold
the backtrace responsible for the latest successful lock operation.

For this, you just need to do this:

    typedef struct dt_pthread_mutex_t
    {
        ....
        void *last_lock_bt[10];  // <-- New member
    }

And then add this other line to both the
"dt_pthread_mutex_lock_with_caller" and
"dt_pthread_mutex_trylock_with_caller" functions:

    backtrace(mutex->last_lock_bt, 10);

Thanks to this, whenever you arrive to a situation where a thread is
forever locked waiting for a mutex, you can use gdb to print the mutex
structure contents and find out WHO (and WHERE) took the mutex first.

Of course, all of this only takes place when using the DEBUG build...

Do you think it would be a good idea to add this to "upstream"?

By the way, the problem I was debugging  is
http://www.darktable.org/redmine/issues/10131 (in case you want to see how
this mutex backtrace would come handly). Oh! And also, please have a look
at the redmine bug description anyway, as right now any help would be
greatly appreciated. Thanks!
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to