-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtprint_common.h
52 lines (43 loc) · 1.06 KB
/
tprint_common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __TPRINT_COMMON_H__
#define __TPRINT_COMMON_H__
#include<stdio.h>
#include<stdlib.h>
#include<stdarg.h>
#include<string.h>
#include"tprint.h"
extern volatile int tprtlock_v;
extern volatile int tprtctrl_v;
extern volatile int tprt_default_counter;
extern volatile FILE* fp_tprintfs;
#define BUFSZ 512
extern char tprtstrbuf[65][BUFSZ];
extern char tprtfmt[65][BUFSZ];
extern char tprtdata[65][BUFSZ];
extern char tprtbuf[BUFSZ<<4];
#define ARGSZ 256
extern char tprtfarg[65][ARGSZ];
extern char tprtcarg[65][ARGSZ];
extern char tprtargt[65][ARGSZ>>2];
#define TWRAP(stmts) \
do { stmts } while(0)
#ifdef TPRT_SLAVE
#define TPRT_SWITCH\
TWRAP(\
if ( (tprtctrl_v == 1) && \
((tprtsw.proc == 0) || (tprtsw.st[athread_get_id(-1)] == 0)))\
return;\
)
#else
#define TPRT_SWITCH\
TWRAP(if (tprtctrl_v == 1 && \
((tprtsw.proc == 0 || tprtsw.master == 0))) \
return;)
#endif
typedef struct tprint_switch_t {
long long smask;
int st[64];
int master;
int proc;
} TprintSwitch;
extern volatile TprintSwitch tprtsw;
#endif