assignment operators/copy ctors are private for classes which can't be copied
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,25 +64,29 @@ class WXDLLEXPORT wxMutexInternal;
|
|||||||
class WXDLLEXPORT wxMutex
|
class WXDLLEXPORT wxMutex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructor & destructor
|
// constructor & destructor
|
||||||
wxMutex();
|
wxMutex();
|
||||||
~wxMutex();
|
~wxMutex();
|
||||||
|
|
||||||
// Lock the mutex.
|
// Lock the mutex.
|
||||||
wxMutexError Lock();
|
wxMutexError Lock();
|
||||||
// Try to lock the mutex: if it can't, returns immediately with an error.
|
// Try to lock the mutex: if it can't, returns immediately with an error.
|
||||||
wxMutexError TryLock();
|
wxMutexError TryLock();
|
||||||
// Unlock the mutex.
|
// Unlock the mutex.
|
||||||
wxMutexError Unlock();
|
wxMutexError Unlock();
|
||||||
|
|
||||||
// Returns true if the mutex is locked.
|
// Returns true if the mutex is locked.
|
||||||
bool IsLocked() const { return (m_locked > 0); }
|
bool IsLocked() const { return (m_locked > 0); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class wxCondition;
|
friend class wxCondition;
|
||||||
|
|
||||||
int m_locked;
|
// no assignment operator nor copy ctor
|
||||||
wxMutexInternal *p_internal;
|
wxMutex(const wxMutex&);
|
||||||
|
wxMutex& operator=(const wxMutex&);
|
||||||
|
|
||||||
|
int m_locked;
|
||||||
|
wxMutexInternal *p_internal;
|
||||||
};
|
};
|
||||||
|
|
||||||
// a helper class which locks the mutex in the ctor and unlocks it in the dtor:
|
// a helper class which locks the mutex in the ctor and unlocks it in the dtor:
|
||||||
@@ -102,6 +106,10 @@ public:
|
|||||||
~wxMutexLocker() { if ( IsOk() ) m_mutex->Unlock(); }
|
~wxMutexLocker() { if ( IsOk() ) m_mutex->Unlock(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// no assignment operator nor copy ctor
|
||||||
|
wxMutexLocker(const wxMutexLocker&);
|
||||||
|
wxMutexLocker& operator=(const wxMutexLocker&);
|
||||||
|
|
||||||
bool m_isOk;
|
bool m_isOk;
|
||||||
wxMutex *m_mutex;
|
wxMutex *m_mutex;
|
||||||
};
|
};
|
||||||
@@ -131,6 +139,10 @@ public:
|
|||||||
void Leave();
|
void Leave();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// no assignment operator nor copy ctor
|
||||||
|
wxCriticalSection(const wxCriticalSection&);
|
||||||
|
wxCriticalSection& operator=(const wxCriticalSection&);
|
||||||
|
|
||||||
wxCriticalSectionInternal *m_critsect;
|
wxCriticalSectionInternal *m_critsect;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -145,6 +157,10 @@ public:
|
|||||||
{ m_critsect.Leave(); }
|
{ m_critsect.Leave(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// no assignment operator nor copy ctor
|
||||||
|
wxCriticalSectionLocker(const wxCriticalSectionLocker&);
|
||||||
|
wxCriticalSectionLocker& operator=(const wxCriticalSectionLocker&);
|
||||||
|
|
||||||
wxCriticalSection& m_critsect;
|
wxCriticalSection& m_critsect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user