...
I have played with #define LOCK_TRACKING 1 - GREAT WORK THANK YOU!
...
You're welcome
Yes Con designed all of the cglock code and wrote almost all of it.
I've had a few deadlocks I've coded in the past, so I wrote the lock tracking to be able to find them easily when I cause them.
Nice hack for lockstats to make them usable or at least for me api.c
#if LOCK_TRACKING
FILE * pFile;
#define LOCK_FMT_FFL " - called from %s %s():%d"
#define LOCKMSG(fmt, ...) fprintf(pFile, "APILOCK: " fmt "\n", ##__VA_ARGS__)
#define LOCKMSGMORE(fmt, ...) fprintf(pFile, " " fmt "\n", ##__VA_ARGS__)
#define LOCKMSGFFL(fmt, ...) fprintf(pFile, "APILOCK: " fmt LOCK_FMT_FFL "\n", ##__VA_ARGS__, file, func, linenum)
#define LOCKMSGFLUSH() fflush(pFile)
then
void show_locks()
{
pFile = fopen ("/tmp/cglocks","w");
..........
fclose (pFile);
}
So no need to stare over console and catch the lines moving
PS:
Guy's
What about
cg_wlock(&control_lock);
.....local_work++;
.....total_work++;
cg_wunlock(&control_lock);
I think there is a need to lock them everywhere or ?
Thanks