summaryrefslogtreecommitdiff
path: root/libclapi
diff options
context:
space:
mode:
authorJunyan He <junyan.he@intel.com>2016-04-22 23:07:19 +0800
committerJunyan He <junyan.he@intel.com>2016-04-22 23:07:19 +0800
commitaa29042f882eb4d7356a7e2f51275998ae95eb27 (patch)
treebdb337f9bd4e9e10d5a08d73478c1b8f3951c716 /libclapi
parentaebbf5a836efff5e2fcc3999c918892c967d5cdd (diff)
lock
Diffstat (limited to 'libclapi')
-rw-r--r--libclapi/cl_mutex.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libclapi/cl_mutex.c b/libclapi/cl_mutex.c
index 52e0a446..217b7730 100644
--- a/libclapi/cl_mutex.c
+++ b/libclapi/cl_mutex.c
@@ -101,6 +101,7 @@ static int before_get_the_mutex(pthread_mutex_t* mutex, char* file, int line)
item = malloc(sizeof(_cl_mutex_log_item));
assert(item);
memset(item, 0, sizeof(_cl_mutex_log_item));
+ item->mutex = mutex;
item->waiter[0].file = file;
item->waiter[0].line = line;
item->waiter[0].tid = tid;
@@ -363,13 +364,13 @@ static void handle_deadlock(pthread_mutex_t* mutex, char* file, int line)
}
printf("------------------------------------------------------\n");
if (item == NULL) {
- printf("We may dead lock at a unknown mutex, call lock point is"
- "file: %s, line: %d\n", file, line);
+ printf("We may dead lock at a unknown mutex, call lock point is\n"
+ " file: %s, line: %d\n", file, line);
} else {
print_others = 1;
- printf("We may dead lock at a mutex:%p, call lock point is"
- "file: %s, line: %d, thread id is %d.\nThe mutex is held by"
- "file: %s, line: %d, thread is is %d\n",
+ printf("We may dead lock at a mutex:%p, call lock point is\n"
+ " file: %s, line: %d, thread id is %d.\nThe mutex is held by\n"
+ " file: %s, line: %d, thread is is %d\n",
mutex, file, line, (int)tid, item->holder.file, item->holder.line,
(int)item->holder.tid);
@@ -409,7 +410,7 @@ static void handle_deadlock(pthread_mutex_t* mutex, char* file, int line)
}
assert(num == cl_mutex_log_num);
- exit(0);
+ assert(0);
pthread_mutex_unlock(&cl_mutex_log_lock);
}