sync.h
1.78 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*************************************************************************
*
* File: sync.h
*
* Header file for the synchronization module.
*
* $Header: /root/leakn64/depot/rf/sw/n64os20l/iosim/src/sync.h,v 1.2 2002/05/30 05:52:53 whs Exp $
*
*/
#ifndef _SYNC_H_
#define _SYNC_H_
#ifdef __sgi__
#include <ulocks.h>
/**********************************************************************
* Common definitions
*/
/*
* IDs for different locks
*/
#define MAX_LOCK 8
#define SYS_LOCK_ID 0
#define LOG_LOCK_ID (SYS_LOCK_ID+1)
#define PI_LOCK_ID (LOG_LOCK_ID+1)
#define SI_LOCK_ID (PI_LOCK_ID+1)
#define AI_LOCK_ID (SI_LOCK_ID+1)
#define VI_LOCK_ID (AI_LOCK_ID+1)
#define SP_LOCK_ID (VI_LOCK_ID+1)
#define DPC_LOCK_ID (SP_LOCK_ID+1)
#define SYS_LOCK SyncLock[SYS_LOCK_ID]
#define LOG_LOCK SyncLock[LOG_LOCK_ID]
#define PI_LOCK SyncLock[PI_LOCK_ID]
#define SI_LOCK SyncLock[SI_LOCK_ID]
#define AI_LOCK SyncLock[AI_LOCK_ID]
#define VI_LOCK SyncLock[VI_LOCK_ID]
#define SP_LOCK SyncLock[SP_LOCK_ID]
#define DPC_LOCK SyncLock[DPC_LOCK_ID]
/* Redefine fprintf to use the locking LogPrintf so that it would work in
* both multi-threaded and single-threaded environment
*/
#define fprintf LogPrintf
/**********************************************************************
* Macro definitions
*/
/***********************************************************************
* External definitions
*/
extern usptr_t *SyncArena;
extern ulock_t SyncLock[];
/***********************************************************************
* External declartions
*/
extern int LockSet(ulock_t);
extern int LockReset(ulock_t);
extern void SysLockSet(void);
extern void SysLockReset(void);
extern void SyncInit(void);
#endif
extern int LogPrintf(FILE *, const char *, ... );
#endif /* _SYNC_H_ */