diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/thread/dispatcher.cc | 14 | ||||
-rw-r--r-- | examples/thread/dispatcher2.cc | 16 | ||||
-rw-r--r-- | examples/thread/threadpool.cc | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/examples/thread/dispatcher.cc b/examples/thread/dispatcher.cc index 3971be8c..cfbd7c01 100644 --- a/examples/thread/dispatcher.cc +++ b/examples/thread/dispatcher.cc @@ -20,7 +20,7 @@ namespace { Glib::RefPtr<Glib::MainLoop> main_loop; -class ThreadProgress : public SigC::Object +class ThreadProgress : public sigc::trackable { public: ThreadProgress(int id, Glib::Mutex& mtx); @@ -28,7 +28,7 @@ public: void launch(); - typedef SigC::Signal1<void, ThreadProgress*> type_signal_finished; + typedef sigc::signal<void, ThreadProgress*> type_signal_finished; type_signal_finished& signal_finished(); int id() const; @@ -44,7 +44,7 @@ private: }; //TODO: Rename to avoid confusion with Glib::Dispatcher. -class Dispatcher : public SigC::Object +class Dispatcher : public sigc::trackable { public: Dispatcher(); @@ -65,7 +65,7 @@ ThreadProgress::ThreadProgress(int id, Glib::Mutex& mtx) progress_ (0), id_ (id), cout_mutex_ (mtx) { // Connect to the cross-thread signal. - signal_increment_.connect(SigC::slot(*this, &ThreadProgress::progress_increment)); + signal_increment_.connect(sigc::mem_fun(*this, &ThreadProgress::progress_increment)); } ThreadProgress::~ThreadProgress() @@ -74,7 +74,7 @@ ThreadProgress::~ThreadProgress() void ThreadProgress::launch() { // Create a non-joinable thread -- it's deleted automatically on thread exit. - Glib::Thread::create(SigC::slot_class(*this, &ThreadProgress::thread_function), false); + Glib::Thread::create(sigc::mem_fun(*this, &ThreadProgress::thread_function), false); } ThreadProgress::type_signal_finished& ThreadProgress::signal_finished() @@ -128,7 +128,7 @@ Dispatcher::Dispatcher() progress_list_.push_back(progress); progress->signal_finished().connect( - SigC::slot(*this, &Dispatcher::on_progress_finished)); + sigc::mem_fun(*this, &Dispatcher::on_progress_finished)); } } @@ -166,7 +166,7 @@ int main(int argc, char** argv) // Install a one-shot idle handler to launch the threads Glib::signal_idle().connect( - SigC::bind_return(SigC::slot(dispatcher, &Dispatcher::launch_threads), false)); + sigc::bind_return(sigc::mem_fun(dispatcher, &Dispatcher::launch_threads), false)); main_loop->run(); diff --git a/examples/thread/dispatcher2.cc b/examples/thread/dispatcher2.cc index 70e65ab5..c2270181 100644 --- a/examples/thread/dispatcher2.cc +++ b/examples/thread/dispatcher2.cc @@ -30,7 +30,7 @@ namespace { Glib::RefPtr<Glib::MainLoop> main_loop; -class ThreadTimer : public SigC::Object +class ThreadTimer : public sigc::trackable { public: ThreadTimer(); @@ -61,7 +61,7 @@ private: }; //TODO: Rename to avoid confusion with Glib::Dispatcher. murrayc -class Dispatcher : public SigC::Object +class Dispatcher : public sigc::trackable { public: Dispatcher(); @@ -82,7 +82,7 @@ ThreadTimer::ThreadTimer() signal_finished_ptr_ (NULL) { // Connect the cross-thread signal. - signal_increment_.connect(SigC::slot(*this, &ThreadTimer::timer_increment)); + signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment)); } ThreadTimer::~ThreadTimer() @@ -98,7 +98,7 @@ void ThreadTimer::launch() // Create a joinable thread -- it needs to be joined, otherwise it's a memory leak. thread_ = Glib::Thread::create( - SigC::slot_class(*this, &ThreadTimer::thread_function), true); + sigc::mem_fun(*this, &ThreadTimer::thread_function), true); // Wait for the 2nd thread's startup notification. while(signal_finished_ptr_ == NULL) @@ -164,7 +164,7 @@ void ThreadTimer::thread_function() // attach a timeout handler, that is called every second, to the // newly created MainContext - context->signal_timeout().connect(SigC::slot(*this, &ThreadTimer::timeout_handler), 1000); + context->signal_timeout().connect(sigc::mem_fun(*this, &ThreadTimer::timeout_handler), 1000); // We need to lock while creating the Dispatcher instance, // in order to ensure memory visibility. @@ -173,7 +173,7 @@ void ThreadTimer::thread_function() // create a new dispatcher, that is connected to the newly // created MainContext Glib::Dispatcher signal_finished (context); - signal_finished.connect(SigC::bind(SigC::slot(&ThreadTimer::finished_handler), mainloop)); + signal_finished.connect(sigc::bind(sigc::ptr_fun(&ThreadTimer::finished_handler), mainloop)); signal_finished_ptr_ = &signal_finished; @@ -195,7 +195,7 @@ Dispatcher::Dispatcher() std::cout << "Thread Dispatcher Example #2" << std::endl; timer_ = new ThreadTimer(); - timer_->signal_end().connect(SigC::slot(*this, &Dispatcher::end)); + timer_->signal_end().connect(sigc::mem_fun(*this, &Dispatcher::end)); timer_->print(); } @@ -223,7 +223,7 @@ int main(int argc, char** argv) // Install a one-shot idle handler to launch the threads Glib::signal_idle().connect( - SigC::bind_return(SigC::slot(dispatcher, &Dispatcher::launch_thread), false)); + sigc::bind_return(sigc::mem_fun(dispatcher, &Dispatcher::launch_thread), false)); main_loop->run(); diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc index 721f7f2f..9fc58888 100644 --- a/examples/thread/threadpool.cc +++ b/examples/thread/threadpool.cc @@ -36,7 +36,7 @@ int main(int, char**) Glib::ThreadPool pool (10); for(char c = 'a'; c <= 'z'; ++c) - pool.push(SigC::bind(SigC::slot(&print_char), c)); + pool.push(sigc::bind(sigc::ptr_fun(&print_char), c)); pool.shutdown(); |