fix locks

This commit is contained in:
Vítor Santos Costa
2015-06-19 10:10:02 +01:00
parent 1c06bfdc05
commit f5b50a4179
10 changed files with 62 additions and 49 deletions

View File

@@ -22,13 +22,13 @@
#include <pthread.h>
//#define DEBUG_PE_LOCKS 1
#define DEBUG_LOCKS 1
//#define DEBUG_LOCKS 1
#include <stdio.h>
int Yap_ThreadID( void );
#define debugf stdout
#define debugf ( stderr ? stderr : stdout )
#define INIT_LOCK(LOCK_VAR) (void)(fprintf(debugf, "[%d] %s:%d: LOCK(%p)\n", Yap_ThreadID(),__BASE_FILE__, __LINE__,&(LOCK_VAR)) && pthread_mutex_init(&(LOCK_VAR), NULL) )
#define INIT_LOCK(LOCK_VAR) pthread_mutex_init(&(LOCK_VAR), NULL)
#define DESTROY_LOCK(LOCK_VAR) pthread_mutex_destroy(&(LOCK_VAR))
#define TRY_LOCK(LOCK_VAR) pthread_mutex_trylock(&(LOCK_VAR))
#if DEBUG_LOCKS