diff options
author | Marcin Kolny <marcin.kolny@gmail.com> | 2015-08-08 14:45:12 +0200 |
---|---|---|
committer | Marcin Kolny <marcin.kolny@gmail.com> | 2015-08-08 14:45:59 +0200 |
commit | 0d5f63b18f5766760cf39e82ee11482984e0a938 (patch) | |
tree | e3f74b9b37e7618c92840024077dff43e6d08f0d /examples/thread/dispatcher2.cc | |
parent | dce7a844e48a582e42eb2b60eef5c1f2527540ac (diff) | |
parent | d94115843f38967b5e883f5f7d8057882ae364cb (diff) | |
download | glibmm-gir-gmmproc.tar.gz |
Merge branch 'master' into glibmm-gir-gmmprocglibmm-gir-gmmproc
Diffstat (limited to 'examples/thread/dispatcher2.cc')
-rw-r--r-- | examples/thread/dispatcher2.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/thread/dispatcher2.cc b/examples/thread/dispatcher2.cc index dd7d7de8..cd0faf26 100644 --- a/examples/thread/dispatcher2.cc +++ b/examples/thread/dispatcher2.cc @@ -77,7 +77,7 @@ ThreadTimer::ThreadTimer() // Create a new Glib::Dispatcher that is attached to the default main context, signal_increment_ (), // This pointer will be initialized later by the 2nd thread. - signal_finished_ptr_ (NULL) + signal_finished_ptr_ (nullptr) { // Connect the cross-thread signal. signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment)); @@ -99,7 +99,7 @@ void ThreadTimer::launch() sigc::mem_fun(*this, &ThreadTimer::thread_function)); // Wait for the 2nd thread's startup notification. - while(signal_finished_ptr_ == NULL) + while(!signal_finished_ptr_) startup_cond_.wait(startup_mutex_); } @@ -109,10 +109,10 @@ void ThreadTimer::signal_finished_emit() signal_finished_ptr_->emit(); // wait for the thread to join - if(thread_ != NULL) + if(thread_) thread_->join(); - signal_finished_ptr_ = NULL; + signal_finished_ptr_ = nullptr; } void ThreadTimer::print() const @@ -156,9 +156,9 @@ bool ThreadTimer::timeout_handler() void ThreadTimer::thread_function() { // create a new Main Context - Glib::RefPtr<Glib::MainContext> context = Glib::MainContext::create(); + auto context = Glib::MainContext::create(); // create a new Main Loop - Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(context, true); + auto mainloop = Glib::MainLoop::create(context, true); // attach a timeout handler, that is called every second, to the // newly created MainContext @@ -189,7 +189,7 @@ ThreadTimer::type_signal_end ThreadTimer::signal_end_; ThreadDispatcher::ThreadDispatcher() : - timer_ (NULL) + timer_ (nullptr) { std::cout << "Thread Dispatcher Example #2" << std::endl; |