Skip to content
Snippets Groups Projects
Commit 8e40e83f authored by Per Hedbor's avatar Per Hedbor
Browse files

Fixed the unlocking/locking order. Sometimes a deadlock occured.

Rev: lib/modules/Thread.pmod:1.8
parent f729e8fb
Branches
Tags
No related merge requests found
...@@ -52,6 +52,7 @@ class Queue { ...@@ -52,6 +52,7 @@ class Queue {
object key=lock::lock(); object key=lock::lock();
while(!size()) r_cond::wait(key); while(!size()) r_cond::wait(key);
tmp=buffer[r_ptr++]; tmp=buffer[r_ptr++];
key=0;
return tmp; return tmp;
} }
...@@ -67,6 +68,7 @@ class Queue { ...@@ -67,6 +68,7 @@ class Queue {
} }
buffer[w_ptr]=v; buffer[w_ptr]=v;
w_ptr++; w_ptr++;
key=0; // Must free this one _before_ the signal...
r_cond::signal(); r_cond::signal();
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment