[Toxine-cvs] CVS: toxine/src common.h,1.32,1.33 main.c,1.36,1.37
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-30 23:23:05
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30211 Modified Files: common.h main.c Log Message: more accurate when reporting deadlock Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- common.h 30 May 2004 22:25:05 -0000 1.32 +++ common.h 30 May 2004 23:22:39 -0000 1.33 @@ -200,22 +200,23 @@ } while(0) -#define start_watchdog(x,f) do { \ - pthread_mutex_lock(&(x)->watchdog.mutex); \ - if((x)->watchdog.running) { \ - perr("GASP! Watchdog is already running for '%s()'\n", (x)->watchdog.function); \ - abort(); \ - } \ - snprintf((x)->watchdog.function, sizeof((x)->watchdog.function), "%s", (f)); \ - (x)->watchdog.running = 1; \ - gettimeofday(&(x)->watchdog.tv, NULL); \ - pthread_mutex_unlock(&(x)->watchdog.mutex); \ +#define start_watchdog(x,f) do { \ + if((x)->watchdog.enabled) { \ + pthread_mutex_lock(&(x)->watchdog.mutex); \ + snprintf((x)->watchdog.function, sizeof((x)->watchdog.function), "%s(%s:%d)", \ + (f), __tox_func__, __LINE__); \ + (x)->watchdog.running = 1; \ + gettimeofday(&(x)->watchdog.tv, NULL); \ + pthread_mutex_unlock(&(x)->watchdog.mutex); \ + } \ } while(0) -#define stop_watchdog(x) do { \ - pthread_mutex_lock(&(x)->watchdog.mutex); \ - (x)->watchdog.running = 0; \ - pthread_mutex_unlock(&(x)->watchdog.mutex); \ +#define stop_watchdog(x) do { \ + if((x)->watchdog.enabled) { \ + pthread_mutex_lock(&(x)->watchdog.mutex); \ + (x)->watchdog.running = 0; \ + pthread_mutex_unlock(&(x)->watchdog.mutex); \ + } \ } while(0) #ifndef NAME_MAX Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- main.c 30 May 2004 22:25:05 -0000 1.36 +++ main.c 30 May 2004 23:22:39 -0000 1.37 @@ -131,7 +131,7 @@ if(timeout > tox->watchdog.timeout) { pout("\n"); perr("Watchdog triggered:\n"); - perr(" Time exceeded, >%ds, in function '%s()', exiting...\n", + perr(" Time exceeded, >%ds, in function '%s', exiting...\n", tox->watchdog.timeout, tox->watchdog.function); exit(TOX_ERR_DEADLOCK); |