diff options
author | Junyan He <junyan.he@intel.com> | 2016-04-22 18:58:36 +0800 |
---|---|---|
committer | Junyan He <junyan.he@intel.com> | 2016-04-22 18:58:36 +0800 |
commit | aebbf5a836efff5e2fcc3999c918892c967d5cdd (patch) | |
tree | 35d66bfa66a3d0be2605442ac180491517ef7219 | |
parent | 82e569d43541665b060f9f652d82f88a41e728c3 (diff) |
lock
-rw-r--r-- | libclapi/cl_mutex.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libclapi/cl_mutex.c b/libclapi/cl_mutex.c index adffacbc..52e0a446 100644 --- a/libclapi/cl_mutex.c +++ b/libclapi/cl_mutex.c @@ -79,7 +79,7 @@ static int before_get_the_mutex(pthread_mutex_t* mutex, char* file, int line) pthread_mutex_lock(&cl_mutex_log_lock); for (i = 0; i < cl_mutex_log_map_size; i++) { - if (cl_mutex_log_map[i]->mutex == mutex) { + if (cl_mutex_log_map[i] && cl_mutex_log_map[i]->mutex == mutex) { item = cl_mutex_log_map[i]; break; } @@ -132,7 +132,7 @@ static void after_get_the_mutex(pthread_mutex_t* mutex, char* file, int line, in pthread_mutex_lock(&cl_mutex_log_lock); for (i = 0; i < cl_mutex_log_map_size; i++) { - if (cl_mutex_log_map[i]->mutex == mutex) { + if (cl_mutex_log_map[i] && cl_mutex_log_map[i]->mutex == mutex) { item = cl_mutex_log_map[i]; break; } @@ -174,7 +174,7 @@ static void before_release_the_mutex(pthread_mutex_t* mutex, char* file, int li pthread_mutex_lock(&cl_mutex_log_lock); for (i = 0; i < cl_mutex_log_map_size; i++) { - if (cl_mutex_log_map[i]->mutex == mutex) { + if (cl_mutex_log_map[i] && cl_mutex_log_map[i]->mutex == mutex) { item = cl_mutex_log_map[i]; break; } @@ -230,7 +230,7 @@ static void before_destroy_mutex(pthread_mutex_t* mutex, char* file, int line) pthread_mutex_lock(&cl_mutex_log_lock); for (i = 0; i < cl_mutex_log_map_size; i++) { - if (cl_mutex_log_map[i]->mutex == mutex) { + if (cl_mutex_log_map[i] && cl_mutex_log_map[i]->mutex == mutex) { item = cl_mutex_log_map[i]; break; } @@ -289,7 +289,7 @@ static int before_sleep_on_the_mutex(pthread_cond_t* cond, pthread_mutex_t* mute pthread_mutex_lock(&cl_mutex_log_lock); for (i = 0; i < cl_mutex_log_map_size; i++) { - if (cl_mutex_log_map[i]->mutex == mutex) { + if (cl_mutex_log_map[i] && cl_mutex_log_map[i]->mutex == mutex) { item = cl_mutex_log_map[i]; break; } @@ -356,7 +356,7 @@ static void handle_deadlock(pthread_mutex_t* mutex, char* file, int line) pthread_mutex_lock(&cl_mutex_log_lock); for (i = 0; i < cl_mutex_log_map_size; i++) { - if (cl_mutex_log_map[i]->mutex == mutex) { + if (cl_mutex_log_map[i] && cl_mutex_log_map[i]->mutex == mutex) { item = cl_mutex_log_map[i]; break; } |