Fix threads initialization in kopete libjingle

[taken from FreeBSD kopete patches]
(cherry picked from commit 34dd52adff)
pull/38/head
Slávek Banko 10 years ago
parent 63de5bec69
commit f2a40364e8

@ -83,8 +83,10 @@ class CriticalSection {
public: public:
CriticalSection() { CriticalSection() {
pthread_mutexattr_t mutex_attribute; pthread_mutexattr_t mutex_attribute;
pthread_mutexattr_init(&mutex_attribute);
pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE); pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&mutex_, &mutex_attribute); pthread_mutex_init(&mutex_, &mutex_attribute);
pthread_mutexattr_destroy(&mutex_attribute);
} }
~CriticalSection() { ~CriticalSection() {
pthread_mutex_destroy(&mutex_); pthread_mutex_destroy(&mutex_);

@ -113,6 +113,7 @@ void Thread::Start() {
pthread_attr_t attr; pthread_attr_t attr;
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_create(&thread_, &attr, PreLoop, this); pthread_create(&thread_, &attr, PreLoop, this);
pthread_attr_destroy(&attr);
started_ = true; started_ = true;
} }

@ -66,6 +66,7 @@ LinphoneMediaChannel::LinphoneMediaChannel() {
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_create(&thread_, &attr, &thread_function, this); pthread_create(&thread_, &attr, &thread_function, this);
pthread_attr_destroy(&attr);
} }
LinphoneMediaChannel::~LinphoneMediaChannel() { LinphoneMediaChannel::~LinphoneMediaChannel() {

Loading…
Cancel
Save