summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2015-11-26 21:13:41 +0100
committerMurray Cumming <murrayc@murrayc.com>2015-11-26 21:13:41 +0100
commitdc9e30902a2f3377ef607deb92ced881c224550b (patch)
tree451ca1ae8a1f839f0d46c0acdcbfa28b71ac6599
parentdd6fd4e9030ae7e64b42d1d2b1f0b842635836ea (diff)
downloadglibmm-dc9e30902a2f3377ef607deb92ced881c224550b.tar.gz
Deprecated Glib::ThreadPool.
Because we should encourage the use of 2 different thread APIs at the same time. Maybe std::async() does what a thread pool would do? If so, we should improve the deprecation documentation.
-rw-r--r--examples/thread/threadpool.cc6
-rw-r--r--glib/glibmm/threadpool.cc4
-rw-r--r--glib/glibmm/threadpool.h10
3 files changed, 20 insertions, 0 deletions
diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc
index e5cd68cf..b1a382da 100644
--- a/examples/thread/threadpool.cc
+++ b/examples/thread/threadpool.cc
@@ -2,11 +2,17 @@
#include <iostream>
#include <thread>
#include <mutex>
+
+//TODO: Remove this example sometime. Glib::ThreadPool is deprecated.
+//TODO: Maybe use std::async() instead?
+#undef GLIBMM_DISABLE_DEPRECATED
+
#include <glibmm/random.h>
#include <glibmm/threadpool.h>
#include <glibmm/timer.h>
+
namespace
{
diff --git a/glib/glibmm/threadpool.cc b/glib/glibmm/threadpool.cc
index fa8f8c99..198e7ed4 100644
--- a/glib/glibmm/threadpool.cc
+++ b/glib/glibmm/threadpool.cc
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef GLIBMM_DISABLE_DEPRECATED
+
#include <glibmmconfig.h>
#include <glibmm/threadpool.h>
#include <glibmm/exceptionhandler.h>
@@ -240,3 +242,5 @@ void ThreadPool::stop_unused_threads()
} // namespace Glib
+#endif // GLIBMM_DISABLE_DEPRECATED
+
diff --git a/glib/glibmm/threadpool.h b/glib/glibmm/threadpool.h
index 696e69f4..8b920107 100644
--- a/glib/glibmm/threadpool.h
+++ b/glib/glibmm/threadpool.h
@@ -21,6 +21,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef GLIBMM_DISABLE_DEPRECATED
+
#include <sigc++/sigc++.h>
extern "C" { typedef struct _GThreadPool GThreadPool; }
@@ -31,10 +33,17 @@ namespace Glib
/** @defgroup ThreadPools Thread Pools
* Pools of threads to execute work concurrently.
+ *
+ * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14.
+ *
* @{
*/
+//TODO: Is std::async() an appropriate replacement to mention for this deprecated API?
+
/** A pool of threads to execute work concurrently.
+ *
+ * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14.
*/
class ThreadPool
{
@@ -188,6 +197,7 @@ private:
} // namespace Glib
+#endif // GLIBMM_DISABLE_DEPRECATED
#endif /* _GLIBMM_THREADPOOL_H */