[glibmm] Remove deprecated Thread and Threads API.



commit db75f338fb1865fbec12daae64dac4d0a1b9abf8
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Nov 10 13:26:00 2016 +0100

    Remove deprecated Thread and Threads API.

 examples/Makefile.am            |    6 +-
 examples/thread/thread.cc       |  126 -----
 examples/thread/threadpool.cc   |   68 ---
 glib/glibmm.h                   |    7 -
 glib/glibmm/dispatcher.cc       |   28 -
 glib/glibmm/exceptionhandler.cc |   19 -
 glib/glibmm/filelist.am         |    2 -
 glib/glibmm/main.cc             |   21 -
 glib/glibmm/main.h              |   51 --
 glib/glibmm/threadpool.cc       |  255 ---------
 glib/glibmm/threadpool.h        |  200 -------
 glib/src/filelist.am            |    2 -
 glib/src/thread.ccg             |  427 ---------------
 glib/src/thread.hg              | 1085 ---------------------------------------
 glib/src/threads.ccg            |  302 -----------
 glib/src/threads.hg             |  932 ---------------------------------
 16 files changed, 1 insertions(+), 3530 deletions(-)
---
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 0de871a..885552d 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -32,11 +32,7 @@ check_PROGRAMS =                     \
        options/example                 \
        properties/example              \
        regex/example                   \
-       settings/settings               \
-       thread/dispatcher               \
-       thread/dispatcher2              \
-       thread/thread                   \
-       thread/threadpool
+       settings/settings
 
 glibmm_includes = -I$(top_builddir)/glib $(if $(srcdir:.=),-I$(top_srcdir)/glib)
 giomm_includes  = -I$(top_builddir)/gio $(if $(srcdir:.=),-I$(top_srcdir)/gio)
diff --git a/glib/glibmm.h b/glib/glibmm.h
index b82b143..79d3e1d 100644
--- a/glib/glibmm.h
+++ b/glib/glibmm.h
@@ -84,12 +84,6 @@
 //#include <glibmm/i18n.h> //This must be included by the application, after system headers such as
 //<iostream>.
 
-// Include this first because we need it to be the first thing to include <glib.h>,
-// so we can do an undef trick to still use deprecated API in the header:
-#include <glibmm/thread.h>
-
-#include <glibmm/threads.h>
-
 #include <glibmm/arrayhandle.h>
 #include <glibmm/balancedtree.h>
 #include <glibmm/base64.h>
@@ -140,7 +134,6 @@
 #include <glibmm/slisthandle.h>
 #include <glibmm/spawn.h>
 #include <glibmm/stringutils.h>
-#include <glibmm/threadpool.h>
 #include <glibmm/timer.h>
 #include <glibmm/timeval.h>
 #include <glibmm/timezone.h>
diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc
index 83da346..3c8a65d 100644
--- a/glib/glibmm/dispatcher.cc
+++ b/glib/glibmm/dispatcher.cc
@@ -15,10 +15,6 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef GLIBMM_CAN_USE_THREAD_LOCAL
-#include <glibmm/threads.h>
-#endif
-
 #include <glibmm/dispatcher.h>
 #include <glibmm/exceptionhandler.h>
 #include <glibmm/fileutils.h>
@@ -147,11 +143,7 @@ protected:
   explicit DispatchNotifier(const Glib::RefPtr<MainContext>& context);
 
 private:
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
   static thread_local DispatchNotifier* thread_specific_instance_;
-#else
-  static Glib::Threads::Private<DispatchNotifier> thread_specific_instance_;
-#endif
 
   std::set<const Dispatcher*> deleted_dispatchers_;
 
@@ -175,11 +167,7 @@ private:
 
 // static
 
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
 thread_local DispatchNotifier* DispatchNotifier::thread_specific_instance_ = nullptr;
-#else
-Glib::Threads::Private<DispatchNotifier> DispatchNotifier::thread_specific_instance_;
-#endif
 
 DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
 : deleted_dispatchers_(),
@@ -282,20 +270,12 @@ DispatchNotifier*
 DispatchNotifier::reference_instance(
   const Glib::RefPtr<MainContext>& context, const Dispatcher* dispatcher)
 {
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
   DispatchNotifier* instance = thread_specific_instance_;
-#else
-  DispatchNotifier* instance = thread_specific_instance_.get();
-#endif
 
   if (!instance)
   {
     instance = new DispatchNotifier(context);
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
     thread_specific_instance_ = instance;
-#else
-    thread_specific_instance_.replace(instance);
-#endif
   }
   else
   {
@@ -323,11 +303,7 @@ DispatchNotifier::reference_instance(
 void
 DispatchNotifier::unreference_instance(DispatchNotifier* notifier, const Dispatcher* dispatcher)
 {
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
   DispatchNotifier* const instance = thread_specific_instance_;
-#else
-  DispatchNotifier* const instance = thread_specific_instance_.get();
-#endif
 
   // Yes, the notifier argument is only used to check for sanity.
   g_return_if_fail(instance == notifier);
@@ -344,12 +320,8 @@ DispatchNotifier::unreference_instance(DispatchNotifier* notifier, const Dispatc
   {
     g_return_if_fail(instance->ref_count_ == 0); // could be < 0 if messed up
 
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
     delete thread_specific_instance_;
     thread_specific_instance_ = nullptr;
-#else
-    thread_specific_instance_.replace(nullptr);
-#endif
   }
 }
 
diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc
index 7a16c78..e80e009 100644
--- a/glib/glibmm/exceptionhandler.cc
+++ b/glib/glibmm/exceptionhandler.cc
@@ -19,9 +19,6 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef GLIBMM_CAN_USE_THREAD_LOCAL
-#include <glibmm/threads.h>
-#endif
 #include <glibmmconfig.h>
 #include <glibmm/error.h>
 #include <glibmm/exceptionhandler.h>
@@ -36,11 +33,7 @@ using HandlerList = std::list<sigc::slot<void()>>;
 
 // Each thread has its own list of exception handlers
 // to avoid thread synchronization problems.
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
 static thread_local HandlerList* thread_specific_handler_list = nullptr;
-#else
-static Glib::Threads::Private<HandlerList> thread_specific_handler_list;
-#endif
 
 static void
 glibmm_exception_warning(const GError* error)
@@ -92,20 +85,12 @@ namespace Glib
 sigc::connection
 add_exception_handler(const sigc::slot<void()>& slot)
 {
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
   HandlerList* handler_list = thread_specific_handler_list;
-#else
-  HandlerList* handler_list = thread_specific_handler_list.get();
-#endif
 
   if (!handler_list)
   {
     handler_list = new HandlerList();
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
     thread_specific_handler_list = handler_list;
-#else
-    thread_specific_handler_list.set(handler_list);
-#endif
   }
 
   handler_list->emplace_back(slot);
@@ -130,11 +115,7 @@ exception_handlers_invoke() noexcept
   // handled.  If there are no more handlers in the list and the exception
   // is still unhandled, call glibmm_unexpected_exception().
 
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
   if (HandlerList* const handler_list = thread_specific_handler_list)
-#else
-  if(HandlerList *const handler_list = thread_specific_handler_list.get())
-#endif
   {
     HandlerList::iterator pslot = handler_list->begin();
 
diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am
index dc6615f..afeb2b4 100644
--- a/glib/glibmm/filelist.am
+++ b/glib/glibmm/filelist.am
@@ -30,7 +30,6 @@ glibmm_files_extra_cc =                       \
        signalproxy_connectionnode.cc   \
        streamiochannel.cc              \
        stringutils.cc                  \
-       threadpool.cc                   \
        timer.cc                        \
        timeval.cc                      \
        ustring.cc                      \
@@ -74,7 +73,6 @@ glibmm_files_extra_h =                        \
        slisthandle.h                   \
        streamiochannel.h               \
        stringutils.h                   \
-       threadpool.h                    \
        timer.h                         \
        timeval.h                       \
        ustring.h                       \
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index 06521a4..f549e02 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -17,13 +17,6 @@
 
 #include <glibmmconfig.h> // May define GLIBMM_DISABLE_DEPRECATED
 
-#ifndef GLIBMM_DISABLE_DEPRECATED
-// Include glibmm/thread.h first because we need it to be first to include <glib.h>,
-// so we can do an undef trick to still use deprecated API in the header:
-#include <glibmm/thread.h>
-#include <glibmm/threads.h>
-#endif // GLIBMM_DISABLE_DEPRECATED
-
 #include <glibmm/main.h>
 #include <glibmm/exceptionhandler.h>
 #include <glibmm/wrap.h>
@@ -608,20 +601,6 @@ MainContext::acquire()
   return g_main_context_acquire(gobj());
 }
 
-#ifndef GLIBMM_DISABLE_DEPRECATED
-bool
-MainContext::wait(Glib::Cond& cond, Glib::Mutex& mutex)
-{
-  return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj());
-}
-
-bool
-MainContext::wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex)
-{
-  return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj());
-}
-#endif // GLIBMM_DISABLE_DEPRECATED
-
 void
 MainContext::release()
 {
diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h
index 4dbbf15..2671876 100644
--- a/glib/glibmm/main.h
+++ b/glib/glibmm/main.h
@@ -30,17 +30,6 @@
 namespace Glib
 {
 
-#ifndef GLIBMM_DISABLE_DEPRECATED
-class Cond;
-class Mutex;
-
-namespace Threads
-{
-class Cond;
-class Mutex;
-}
-#endif // GLIBMM_DISABLE_DEPRECATED
-
 /** @defgroup MainLoop The Main Event Loop
  * Manages all available sources of events.
  * @{
@@ -69,16 +58,6 @@ private:
   GPollFD gobject_;
 };
 
-// Concerning SignalTimeout::connect_once(), SignalTimeout::connect_seconds_once()
-// and SignalIdle::connect_once():
-// See https://bugzilla.gnome.org/show_bug.cgi?id=396963 and
-// http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
-// It's recommended to replace sigc::slot<void()>& by std::function<void()>& in
-// Threads::Thread::create() and ThreadPool::push() at the next ABI break.
-// Such a replacement would be a mixed blessing in SignalTimeout and SignalIdle.
-// In a single-threaded program auto-disconnection of trackable slots is safe
-// and can be useful.
-
 class SignalTimeout
 {
 public:
@@ -453,36 +432,6 @@ public:
    */
   bool acquire();
 
-#ifndef GLIBMM_DISABLE_DEPRECATED
-  /** Tries to become the owner of the specified context, as with acquire(). But if another thread
-   * is the owner,
-   * atomically drop mutex and wait on cond until that owner releases ownership or until cond is
-   * signaled, then try
-   * again (once) to become the owner.
-   * @param cond A condition variable.
-   * @param mutex A mutex, currently held.
-   * @return true if the operation succeeded, and this thread is now the owner of context.
-   *
-   * @deprecated Use wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex) instead.
-   */
-  bool wait(Glib::Cond& cond, Glib::Mutex& mutex);
-
-  // Deprecated mostly because it uses deprecated Glib::Threads:: for parameters.
-  /** Tries to become the owner of the specified context, as with acquire(). But if another thread
-   * is the owner,
-   * atomically drop mutex and wait on cond until that owner releases ownership or until cond is
-   * signaled, then try
-   * again (once) to become the owner.
-   * @param cond A condition variable.
-   * @param mutex A mutex, currently held.
-   * @return true if the operation succeeded, and this thread is now the owner of context.
-   *
-   * @deprecated Please use the underlying g_main_context_wait() function if you really need this
-   * functionality.
-   */
-  bool wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex);
-#endif // GLIBMM_DISABLE_DEPRECATED
-
   /** Releases ownership of a context previously acquired by this thread with acquire(). If the
    * context was acquired
    * multiple times, the only release ownership when release() is called as many times as it was
diff --git a/glib/src/filelist.am b/glib/src/filelist.am
index 6b52c61..a8c2c40 100644
--- a/glib/src/filelist.am
+++ b/glib/src/filelist.am
@@ -36,8 +36,6 @@ glibmm_files_any_hg =         \
        regex.hg                \
        shell.hg                \
        spawn.hg                \
-       thread.hg               \
-       threads.hg              \
        timezone.hg             \
        unicode.hg              \
        uriutils.hg             \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]