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
|
size_t recursion;
of_thread_t thread;
of_mutex_t mutex;
};
static of_mutex_t mutex;
static struct locks_s *locks = NULL;
static size_t num_locks = 0;
#define SYNC_ERR(f) \
{ \
fprintf(stderr, "WARNING: %s failed in line %d!\n" \
"WARNING: This might result in a race " \
"condition!\n", f, __LINE__); \
return 1; \
}
BOOL
objc_sync_init()
{
return (of_mutex_new(&mutex) ? YES : NO);
}
int
objc_sync_enter(id obj)
{
int i;
if (obj == nil)
return 0;
if (!of_mutex_lock(&mutex))
SYNC_ERR("of_mutex_lock(&mutex)");
|
|
|
|
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
|
size_t recursion;
of_thread_t thread;
of_mutex_t mutex;
};
static of_mutex_t mutex;
static struct locks_s *locks = NULL;
static ssize_t num_locks = 0;
#define SYNC_ERR(f) \
{ \
fprintf(stderr, "WARNING: %s failed in line %d!\n" \
"WARNING: This might result in a race " \
"condition!\n", f, __LINE__); \
return 1; \
}
BOOL
objc_sync_init()
{
return (of_mutex_new(&mutex) ? YES : NO);
}
int
objc_sync_enter(id obj)
{
ssize_t i;
if (obj == nil)
return 0;
if (!of_mutex_lock(&mutex))
SYNC_ERR("of_mutex_lock(&mutex)");
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
return 0;
}
int
objc_sync_exit(id obj)
{
int i;
if (obj == nil)
return 0;
if (!of_mutex_lock(&mutex))
SYNC_ERR("of_mutex_lock(&mutex)");
|
|
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
return 0;
}
int
objc_sync_exit(id obj)
{
ssize_t i;
if (obj == nil)
return 0;
if (!of_mutex_lock(&mutex))
SYNC_ERR("of_mutex_lock(&mutex)");
|