Permalink
Browse files

Threads: Add some undefined constructors etc

This is needed to "get rid" of the C++ default implementation. Yes, I know that
this can be done way nicer with C++11...

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information...
1 parent e97a3ce commit d128b418449e53e42d45db8d45321b324c67ff6e @psychon psychon committed Aug 6, 2014
Showing with 21 additions and 0 deletions.
  1. +21 −0 include/znc/Threads.h
View
@@ -71,6 +71,10 @@ class CMutex {
}
private:
+ // Undefined copy constructor and assignment operator
+ CMutex(const CMutex&);
+ CMutex& operator=(const CMutex&);
+
pthread_mutex_t m_mutex;
};
@@ -105,6 +109,10 @@ class CMutexLocker {
}
private:
+ // Undefined copy constructor and assignment operator
+ CMutexLocker(const CMutexLocker&);
+ CMutexLocker& operator=(const CMutexLocker&);
+
CMutex &m_mutex;
bool m_locked;
};
@@ -161,6 +169,10 @@ class CConditionVariable {
}
private:
+ // Undefined copy constructor and assignment operator
+ CConditionVariable(const CConditionVariable&);
+ CConditionVariable& operator=(const CConditionVariable&);
+
pthread_cond_t m_cond;
};
@@ -185,13 +197,22 @@ class CThread {
exit(1);
}
}
+
+private:
+ // Undefined constructor
+ CThread();
};
class CJob {
public:
virtual ~CJob() {}
virtual void runThread() = 0;
virtual void runMain() = 0;
+
+private:
+ // Undefined copy constructor and assignment operator
+ CJob(const CJob&);
+ CJob& operator=(const CJob&);
};
class CThreadPool {

0 comments on commit d128b41

Please sign in to comment.