mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user