Signed-off-by: falkTX <falktx@falktx.com>tags/v1.9.19
| @@ -45,7 +45,15 @@ Alsathread::Alsathread (Alsa_pcmi *alsadev, int mode) : | |||||
| Alsathread::~Alsathread (void) | Alsathread::~Alsathread (void) | ||||
| { | { | ||||
| _alsadev->pcm_stop (); | |||||
| if (_state != INIT) | |||||
| { | |||||
| _state = TERM; | |||||
| thr_wait (); | |||||
| } | |||||
| else | |||||
| { | |||||
| _alsadev->pcm_stop (); | |||||
| } | |||||
| } | } | ||||
| @@ -76,3 +76,12 @@ void Pxthread::thr_main (void) | |||||
| { | { | ||||
| } | } | ||||
| void Pxthread::thr_wait (void) | |||||
| { | |||||
| if (_thrid == 0) | |||||
| return; | |||||
| pthread_join (_thrid, NULL); | |||||
| _thrid = 0; | |||||
| } | |||||
| @@ -42,6 +42,7 @@ public: | |||||
| virtual void thr_main (void) = 0; | virtual void thr_main (void) = 0; | ||||
| virtual int thr_start (int policy, int priority, size_t stacksize = 0); | virtual int thr_start (int policy, int priority, size_t stacksize = 0); | ||||
| virtual void thr_wait (void); | |||||
| private: | private: | ||||