Fix error in lock orders.
This commit is contained in:
1 parent
7760f16260
commit
95fcd054a3
1 file changed
+5
-26
+5
-26
@@ -152,21 +152,13 @@
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static inline void \
|
static inline void \
|
||||||
M_C(name, _read_wait)(int *p, const concurrent_t out) \
|
M_C(name, _read_wait)(const concurrent_t out) \
|
||||||
{ \
|
{ \
|
||||||
assert (out->self == out); \
|
assert (out->self == out); \
|
||||||
(void) p; \
|
|
||||||
m_cond_wait(out->self->there_is_data, out->self->lock); \
|
m_cond_wait(out->self->there_is_data, out->self->lock); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static inline void \
|
static inline void \
|
||||||
M_C(name, _read_wait_unlock)(int *p, const concurrent_t out) \
|
|
||||||
{ \
|
|
||||||
(void) p; \
|
|
||||||
m_mutex_unlock (out->self->lock); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
static inline void \
|
|
||||||
M_C(name, _write_lock)(concurrent_t out) \
|
M_C(name, _write_lock)(concurrent_t out) \
|
||||||
{ \
|
{ \
|
||||||
m_mutex_lock (out->lock); \
|
m_mutex_lock (out->lock); \
|
||||||
@@ -524,7 +516,6 @@
|
|||||||
CONCURRENTI_CONTRACT(out); \
|
CONCURRENTI_CONTRACT(out); \
|
||||||
assert (out_data != NULL); \
|
assert (out_data != NULL); \
|
||||||
bool ret = false; \
|
bool ret = false; \
|
||||||
int count = 0; \
|
|
||||||
M_C(name, _read_lock)(out); \
|
M_C(name, _read_lock)(out); \
|
||||||
while (true) { \
|
while (true) { \
|
||||||
M_GET_VALUE_TYPE oplist *p = M_CALL_GET_KEY(oplist, out->data, key); \
|
M_GET_VALUE_TYPE oplist *p = M_CALL_GET_KEY(oplist, out->data, key); \
|
||||||
@@ -534,9 +525,9 @@
|
|||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
if (blocking == false) break; \
|
if (blocking == false) break; \
|
||||||
M_C(name, _read_wait)(&count, out); \
|
M_C(name, _read_wait)(out); \
|
||||||
} \
|
} \
|
||||||
M_C(name, _read_wait_unlock)(&count, out); \
|
M_C(name, _read_unlock)(out); \
|
||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
,) \
|
,) \
|
||||||
@@ -679,23 +670,11 @@
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static inline void \
|
static inline void \
|
||||||
M_C(name, _read_wait)(int *p, const concurrent_t out) \
|
M_C(name, _read_wait)(const concurrent_t out) \
|
||||||
{ \
|
{ \
|
||||||
struct M_C(name, _s) *self = out->self; \
|
struct M_C(name, _s) *self = out->self; \
|
||||||
assert (self == out); \
|
assert (self == out); \
|
||||||
if (*p == 0) { \
|
m_cond_wait(self->there_is_data, self->lock); \
|
||||||
m_mutex_unlock (self->read_lock); \
|
|
||||||
m_mutex_lock (self->lock); \
|
|
||||||
*p = 1; \
|
|
||||||
} else { \
|
|
||||||
m_cond_wait(self->there_is_data, self->lock); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
static inline void \
|
|
||||||
M_C(name, _read_wait_unlock)(int *p, const concurrent_t out) \
|
|
||||||
{ \
|
|
||||||
m_mutex_unlock (*p == 0 ? out->self->read_lock : out->self->lock); \
|
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static inline void \
|
static inline void \
|
||||||
|
|||||||
Reference in new issue
Block a user