Am Montag, 6. Oktober 2014, 00:08:23 schrieb Fernando: > 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!
That sounds useful indeed. Do you know how badly that affects the speed? Maybe it should be kept in for regular builds, too, as DEBUG is kind of useless to find real problems as it changes so many code parts that I am not sure if it couldn't confuse more than it helps (I never ever compile that way). Tobias
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ Slashdot TV. Videos for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________ darktable-devel mailing list darktable-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/darktable-devel