[glibmm] Deprecated Glib::ThreadPool.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Deprecated Glib::ThreadPool.
- Date: Thu, 26 Nov 2015 20:14:42 +0000 (UTC)
commit dc9e30902a2f3377ef607deb92ced881c224550b
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Nov 26 21:13:41 2015 +0100
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.
examples/thread/threadpool.cc | 6 ++++++
glib/glibmm/threadpool.cc | 4 ++++
glib/glibmm/threadpool.h | 10 ++++++++++
3 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc
index e5cd68c..b1a382d 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 fa8f8c9..198e7ed 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 696e69f..8b92010 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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]