Fix race conditions and deadlocks in Channels (hopefully) (issue #554)

Also, this is a giant commit because of the official Code Style (tm) was applied.

--HG--
branch : minor
This commit is contained in:
Bart van Strien
2013-01-30 17:15:12 +01:00
parent be2363fc00
commit c7c5d0ed6b
15 changed files with 414 additions and 367 deletions
+17 -10
View File
@@ -35,16 +35,9 @@ namespace thread
{
class Channel : public love::Object
{
private:
Mutex *mutex;
Conditional *cond;
std::queue<Variant*> queue;
bool named;
std::string name;
Channel(const std::string &name);
unsigned long sent;
unsigned long received;
// FOR WRAPPER USE ONLY
friend void retainVariant(Channel *, Variant *);
friend void releaseVariant(Channel *, Variant *);
public:
Channel();
@@ -61,6 +54,20 @@ public:
void retain();
void release();
private:
Channel(const std::string &name);
void lockMutex();
void unlockMutex();
Mutex *mutex;
Conditional *cond;
std::queue<Variant *> queue;
bool named;
std::string name;
unsigned long sent;
unsigned long received;
}; // Channel
} // thread
} // love