YAP
7.1.0
Toggle main menu visibility
Main Page
Related Pages
Modules
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
y
~
Functions
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
y
~
Variables
a
c
e
f
g
i
k
m
n
o
p
q
r
s
t
v
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Functions
c
e
m
y
Variables
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Macros
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
locks_mips.h
1
/************************************************************************
2
** **
3
** The YapTab/YapOr/OPTYap systems **
4
** **
5
** YapTab extends the Yap Prolog engine to support sequential tabling **
6
** YapOr extends the Yap Prolog engine to support or-parallelism **
7
** OPTYap extends the Yap Prolog engine to support or-parallel tabling **
8
** **
9
** **
10
** Yap Prolog was developed at University of Porto, Portugal **
11
** **
12
************************************************************************/
13
14
/************************************************************************
15
** Atomic locks for MIPS **
16
************************************************************************/
17
18
/* This code is stolen from the Linux kernel */
19
20
typedef
struct
{
unsigned
long
a[100]; }
__dummy_lock_t
;
21
#define __dummy_lock(lock) (*(__dummy_lock_t *)(lock))
22
23
#define load_linked(addr) \
24
({ \
25
unsigned int __res; \
26
\
27
__asm__ __volatile__( \
28
"ll\t%0,(%1)"
\
29
: "=r" (__res) \
30
: "r" ((unsigned long) (addr))); \
31
\
32
__res; \
33
})
34
35
#define store_conditional(addr,value) \
36
({ \
37
int __res; \
38
\
39
__asm__ __volatile__( \
40
"sc\t%0,(%2)"
\
41
: "=r" (__res) \
42
: "0" (value), "r" (addr)); \
43
\
44
__res; \
45
})
46
47
#define INIT_LOCK(LOCK_VAR) ((LOCK_VAR) = 0)
48
#define TRY_LOCK(LOCK_PTR) (!test_and_set_bit(0,(__dumy_lock_t *)(LOCK_PTR)))
49
#define LOCK(LOCK_VAR) _spin_lock((__dummy_lock_t *)(&(LOCK_VAR)))
50
#define IS_LOCKED(LOCK_VAR) ((LOCK_VAR) != 0)
51
#define IS_UNLOCKED(LOCK_VAR) ((LOCK_VAR) == 0)
52
53
54
/* We need to support sync on MIPS */
55
#define UNLOCK(LOCK_VAR) spin_unlock((__dummy_lock_t *)(&(LOCK_VAR)))
56
57
typedef
struct
{
58
volatile
unsigned
int
lock;
59
}
rwlock_t
;
60
61
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
62
63
#define READ_LOCK(X) _read_lock(&(X))
64
65
#define READ_UNLOCK(X) _read_unlock(&(X))
66
67
#define WRITE_LOCK(X) _write_lock(&(X))
68
69
#define WRITE_UNLOCK(X) _write_unlock(&(X))
70
71
#define INIT_RWLOCK(RW) (RW) = RW_LOCK_UNLOCKED
__dummy_lock_t
Definition:
locks_alpha.h:20
rwlock_t
Definition:
locks_alpha.h:38
OPTYap
locks_mips.h
Generated by
1.9.3