Legofit
infers population history from nucleotide site patterns.
dprintf.h
1#ifndef LDPSIZ_DPRINTF_H
2# define LDPSIZ_DPRINTF_H
3# include <pthread.h>
4# include <stdio.h>
5# include <string.h>
14# ifdef DPRINTF_ON
15# define DPRINTF(arg) do{ \
16 int dpr_status; \
17 char dpr_buff[50]; \
18 dpr_status=pthread_mutex_lock(&outputLock); \
19 if(dpr_status) { \
20 strerror_r(dpr_status, dpr_buff, sizeof(dpr_buff)); \
21 fprintf(stderr,"%s:%s:%d: lock %d (%s)\n", \
22 __FILE__,__func__,__LINE__, \
23 dpr_status, dpr_buff); \
24 exit(1); \
25 } \
26 printf arg ; \
27 fflush(stdout); \
28 dpr_status = pthread_mutex_unlock(&outputLock); \
29 if(dpr_status) { \
30 strerror_r(dpr_status, dpr_buff, sizeof(dpr_buff)); \
31 fprintf(stderr,"%s:%s:%d: unlock %d (%s)\n", \
32 __FILE__,__func__,__LINE__, \
33 dpr_status, dpr_buff); \
34 exit(1); \
35 } \
36 }while(0)
37# else
38# define DPRINTF(arg)
39# endif
40#endif