aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-06-29 17:24:21 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-06-29 17:24:21 +0200
commit877c0690c62fb038de3f47a3d7f41bb32960ed33 (patch)
tree04c6cf4ad01d58b147625e2057f37673a7b9489d
parent8d5c996aef28fae9f848e1fab419b4d2821e8862 (diff)
downloadmarkov-k-ram-finer_mutexes.zip
markov-k-ram-finer_mutexes.tar.bz2
Fixes wrong order in lock release.finer_mutexes
-rw-r--r--src/knowledge/knowledge_locks.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/knowledge/knowledge_locks.c b/src/knowledge/knowledge_locks.c
index 8d83664..be37ee7 100644
--- a/src/knowledge/knowledge_locks.c
+++ b/src/knowledge/knowledge_locks.c
@@ -288,10 +288,6 @@ int JH_knowledge_readunlock_word
{
int err;
- if (JH_knowledge_readunlock_words(k, io) < 0)
- {
- return -1;
- }
err = pthread_rwlock_unlock(&(k->words[i].lock));
@@ -304,6 +300,13 @@ int JH_knowledge_readunlock_word
strerror(err)
);
+ JH_knowledge_readunlock_words(k, io);
+
+ return -1;
+ }
+
+ if (JH_knowledge_readunlock_words(k, io) < 0)
+ {
return -1;
}
@@ -319,11 +322,6 @@ int JH_knowledge_writeunlock_word
{
int err;
- if (JH_knowledge_readunlock_words(k, io) < 0)
- {
- return -1;
- }
-
err = pthread_rwlock_unlock(&(k->words[i].lock));
if (err != 0)
@@ -335,6 +333,13 @@ int JH_knowledge_writeunlock_word
strerror(err)
);
+ JH_knowledge_readunlock_words(k, io);
+
+ return -1;
+ }
+
+ if (JH_knowledge_readunlock_words(k, io) < 0)
+ {
return -1;
}