diff options
Diffstat (limited to 'glib/src/threads.hg')
-rw-r--r-- | glib/src/threads.hg | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/glib/src/threads.hg b/glib/src/threads.hg index 412d5fb5..691af058 100644 --- a/glib/src/threads.hg +++ b/glib/src/threads.hg @@ -75,6 +75,10 @@ _WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE) class Thread { public: + + Thread(const Thread&) = delete; + Thread& operator=(const Thread&) = delete; + class Exit; //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue. @@ -154,10 +158,6 @@ private: // Glib::Thread can neither be constructed nor deleted. Thread(); void operator delete(void*, std::size_t); - - // noncopyable - Thread(const Thread&); - Thread& operator=(const Thread&); }; /** %Exception class used to exit from a thread. @@ -195,6 +195,10 @@ public: class Lock; Mutex(); + + Mutex(const Mutex&) = delete; + Mutex& operator=(const Mutex&) = delete; + ~Mutex(); /** Locks the mutex. @@ -223,10 +227,6 @@ public: private: GMutex gobject_; - - // noncopyable - Mutex(const Mutex&); - Mutex& operator=(const Mutex&); }; /** Utility class for exception-safe mutex locking. @@ -248,6 +248,10 @@ public: explicit inline Lock(Mutex& mutex); inline Lock(Mutex& mutex, NotLock); inline Lock(Mutex& mutex, TryLock); + + Lock(const Mutex::Lock&) = delete; + Mutex::Lock& operator=(const Mutex::Lock&) = delete; + inline ~Lock(); inline void acquire(); @@ -258,10 +262,6 @@ public: private: Mutex& mutex_; bool locked_; - - // noncopyable - Lock(const Mutex::Lock&); - Mutex::Lock& operator=(const Mutex::Lock&); }; /** A C++ wrapper for the C object. @@ -288,6 +288,10 @@ public: class Lock; RecMutex(); + + RecMutex(const RecMutex&) = delete; + RecMutex& operator=(const RecMutex&) = delete; + ~RecMutex(); void lock(); @@ -297,10 +301,6 @@ public: GRecMutex* gobj() { return &gobject_; } private: - // noncopyable - RecMutex(const RecMutex&); - RecMutex& operator=(const RecMutex&); - GRecMutex gobject_; }; @@ -312,6 +312,10 @@ public: explicit inline Lock(RecMutex& mutex); inline Lock(RecMutex& mutex, NotLock); inline Lock(RecMutex& mutex, TryLock); + + Lock(const RecMutex::Lock&) = delete; + RecMutex::Lock& operator=(const RecMutex::Lock&) = delete; + inline ~Lock(); inline void acquire(); @@ -322,10 +326,6 @@ public: private: RecMutex& mutex_; bool locked_; - - // noncopyable - Lock(const RecMutex::Lock&); - RecMutex::Lock& operator=(const RecMutex::Lock&); }; /** A C++ wrapper for the C object. @@ -358,6 +358,10 @@ public: class WriterLock; RWLock(); + + RWLock(const RWLock&) = delete; + RWLock& operator=(const RWLock&) = delete; + ~RWLock(); void reader_lock(); @@ -371,10 +375,6 @@ public: GRWLock* gobj() { return &gobject_; } private: - // noncopyable - RWLock(const RWLock&); - RWLock& operator=(const RWLock&); - GRWLock gobject_; }; @@ -386,6 +386,10 @@ public: explicit inline ReaderLock(RWLock& rwlock); inline ReaderLock(RWLock& rwlock, NotLock); inline ReaderLock(RWLock& rwlock, TryLock); + + ReaderLock(const RWLock::ReaderLock&) = delete; + RWLock::ReaderLock& operator=(const RWLock::ReaderLock&) = delete; + inline ~ReaderLock(); inline void acquire(); @@ -396,10 +400,6 @@ public: private: RWLock& rwlock_; bool locked_; - - // noncopyable - ReaderLock(const RWLock::ReaderLock&); - RWLock::ReaderLock& operator=(const RWLock::ReaderLock&); }; /** Utility class for exception-safe locking of read/write locks. @@ -410,6 +410,10 @@ public: explicit inline WriterLock(RWLock& rwlock); inline WriterLock(RWLock& rwlock, NotLock); inline WriterLock(RWLock& rwlock, TryLock); + + WriterLock(const RWLock::WriterLock&) = delete; + RWLock::WriterLock& operator=(const RWLock::WriterLock&) = delete; + inline ~WriterLock(); inline void acquire(); @@ -420,10 +424,6 @@ public: private: RWLock& rwlock_; bool locked_; - - // noncopyable - WriterLock(const RWLock::WriterLock&); - RWLock::WriterLock& operator=(const RWLock::WriterLock&); }; /** An opaque data structure to represent a condition. @@ -462,6 +462,10 @@ class Cond { public: Cond(); + + Cond(const Cond&) = delete; + Cond& operator=(const Cond&) = delete; + ~Cond(); /** If threads are waiting for this @a Cond, exactly one of them is woken up. @@ -538,10 +542,6 @@ public: private: GCond gobject_; - - // noncopyable - Cond(const Cond&); - Cond& operator=(const Cond&); }; /** Thread-local data pointer. @@ -554,6 +554,9 @@ template <class T> class Private { public: + Private(const Private<T>&) = delete; + Private<T>& operator=(const Private<T>&) = delete; + typedef void (*DestructorFunc) (void*); /** Deletes static_cast<T*>(data) @@ -591,10 +594,6 @@ public: private: GPrivate gobject_; - - // noncopyable - Private(const Private<T>&); - Private<T>& operator=(const Private<T>&); }; /** @} group Threads */ |