[ekiga] AudioEventScheduler: Ensure proper termination by PTLIB on shutdown.



commit 7067407f99f50281081a01471dcebfc8f4c7401d
Author: Damien Sandras <dsandras seconix com>
Date:   Sat Feb 7 15:25:19 2015 +0100

    AudioEventScheduler: Ensure proper termination by PTLIB on shutdown.

 lib/engine/audiooutput/audiooutput-scheduler.cpp |   15 +++++++++++++--
 lib/engine/audiooutput/audiooutput-scheduler.h   |    4 +++-
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/lib/engine/audiooutput/audiooutput-scheduler.cpp 
b/lib/engine/audiooutput/audiooutput-scheduler.cpp
index ba8516f..97a64ba 100644
--- a/lib/engine/audiooutput/audiooutput-scheduler.cpp
+++ b/lib/engine/audiooutput/audiooutput-scheduler.cpp
@@ -43,16 +43,21 @@
 using namespace Ekiga;
 
 AudioEventScheduler::AudioEventScheduler (AudioOutputCore& _audio_output_core)
-: PThread (1000, AutoDeleteThread, HighestPriority, "AudioEventScheduler"),
+: PThread (1000, NoAutoDeleteThread, HighestPriority, "AudioEventScheduler"),
   audio_output_core (_audio_output_core)
 {
   end_thread = false;
-  // Since windows does not like to restart a thread that 
+  // Since windows does not like to restart a thread that
   // was never started, we do so here
   this->Resume ();
   thread_created.Wait ();
 }
 
+AudioEventScheduler::~AudioEventScheduler ()
+{
+  quit ();
+}
+
 void AudioEventScheduler::quit ()
 {
   end_thread = true;
@@ -246,6 +251,12 @@ void AudioEventScheduler::load_wav(const std::string & event_name, bool is_file_
 }
 
 
+void AudioEventScheduler::Terminate ()
+{
+  quit ();
+}
+
+
 bool AudioEventScheduler::get_file_name(const std::string & event_name, std::string & file_name, 
AudioOutputPS & ps)
 {
   PWaitAndSignal m(event_file_list_mutex);
diff --git a/lib/engine/audiooutput/audiooutput-scheduler.h b/lib/engine/audiooutput/audiooutput-scheduler.h
index cce3965..fd2d6df 100644
--- a/lib/engine/audiooutput/audiooutput-scheduler.h
+++ b/lib/engine/audiooutput/audiooutput-scheduler.h
@@ -70,11 +70,12 @@ namespace Ekiga
 
   public:
     AudioEventScheduler(Ekiga::AudioOutputCore& _audio_output_core);
+    ~AudioEventScheduler();
     void quit ();
     void add_event_to_queue(const std::string & name, bool is_file_name, unsigned interval, unsigned 
repetitions);
     void remove_event_from_queue(const std::string & name);
     void set_file_name(const std::string & event_name, const std::string & file_name, AudioOutputPS ps, bool 
enabled);
-  
+
   protected:
     void Main (void);
     void get_pending_event_list (std::vector<AudioEvent> & pending_event_list);
@@ -82,6 +83,7 @@ namespace Ekiga
     unsigned get_time_to_next_event();
     bool get_file_name(const std::string & event_name, std::string & file_name, AudioOutputPS & ps);
     void load_wav(const std::string & event_name, bool is_file_name, char* & buffer, unsigned long & len, 
unsigned & channels, unsigned & sample_rate, unsigned & bps, AudioOutputPS & ps);
+    void Terminate ();
 
     PSyncPoint run_thread;
     bool end_thread;


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