diff --git a/shmem.c b/shmem.c index 1fc73c9d..8fd333d0 100644 --- a/shmem.c +++ b/shmem.c @@ -155,15 +155,15 @@ pthread_mutex_t create_mutex() { return lock; } -void _lock_shm(const char* function, const int line) { +void _lock_shm(const char* function, const int line, const char * file) { // Signal that FTL is waiting for a lock shmLock->waitingForLock = true; - if(debug) logg("Waiting for lock in %s():%i", function, line); + if(debug) logg("Waiting for lock in %s() (%s:%i)", function, file, line); int result = pthread_mutex_lock(&shmLock->lock); - if(debug) logg("Obtained lock for %s():%i", function, line); + if(debug) logg("Obtained lock for %s() (%s:%i)", function, file, line); // Turn off the waiting for lock signal to notify everyone who was // deferring to FTL that they can jump in the lock queue. @@ -179,10 +179,10 @@ void _lock_shm(const char* function, const int line) { logg("Failed to obtain SHM lock: %s", strerror(result)); } -void _unlock_shm(const char* function, const int line) { +void _unlock_shm(const char* function, const int line, const char * file) { int result = pthread_mutex_unlock(&shmLock->lock); - if(debug) logg("Removed lock in %s():%i", function, line); + if(debug) logg("Removed lock in %s() (%s:%i)", function, file, line); if(result != 0) logg("Failed to unlock SHM lock: %s", strerror(result)); diff --git a/shmem.h b/shmem.h index cdc3b0d7..377dab67 100644 --- a/shmem.h +++ b/shmem.h @@ -41,11 +41,11 @@ bool realloc_shm(SharedMemory *sharedMemory, size_t size); void delete_shm(SharedMemory *sharedMemory); /// Block until a lock can be obtained -#define lock_shm() _lock_shm(__FUNCTION__, __LINE__); -void _lock_shm(const char* func, const int line); +#define lock_shm() _lock_shm(__FUNCTION__, __LINE__, __FILE__); +void _lock_shm(const char* func, const int line, const char* file); /// Unlock the lock. Only call this if there is an active lock. -#define unlock_shm() _unlock_shm(__FUNCTION__, __LINE__); -void _unlock_shm(const char* func, const int line); +#define unlock_shm() _unlock_shm(__FUNCTION__, __LINE__, __FILE__); +void _unlock_shm(const char* func, const int line, const char* file); #endif //SHARED_MEMORY_SERVER_H