summaryrefslogtreecommitdiffstats
path: root/third_party/libjingle
diff options
context:
space:
mode:
authorzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 21:34:07 +0000
committerzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 21:34:07 +0000
commit5a39cf9fd70c87bbe15d2b7e03b94e675cf5c225 (patch)
treef48defcf7c1ed91bce5f054e5e79f9e509a37bbc /third_party/libjingle
parentb9fabd0dc1c046e8e1aced7df017eec995119b9d (diff)
downloadchromium_src-5a39cf9fd70c87bbe15d2b7e03b94e675cf5c225.zip
chromium_src-5a39cf9fd70c87bbe15d2b7e03b94e675cf5c225.tar.gz
chromium_src-5a39cf9fd70c87bbe15d2b7e03b94e675cf5c225.tar.bz2
Fix a race condition in signal thread destructor.
BUG=23251 TEST=none Review URL: http://codereview.chromium.org/402026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libjingle')
-rw-r--r--third_party/libjingle/files/talk/base/signalthread.cc3
-rw-r--r--third_party/libjingle/files/talk/base/signalthread.h13
2 files changed, 14 insertions, 2 deletions
diff --git a/third_party/libjingle/files/talk/base/signalthread.cc b/third_party/libjingle/files/talk/base/signalthread.cc
index 919d1c3..0b5154d6 100644
--- a/third_party/libjingle/files/talk/base/signalthread.cc
+++ b/third_party/libjingle/files/talk/base/signalthread.cc
@@ -10,10 +10,11 @@ using namespace talk_base;
SignalThread::SignalThread()
: main_(Thread::Current()), state_(kInit)
{
- worker_.parent_ = this;
+ worker_.SetParent(this);
}
SignalThread::~SignalThread() {
+ worker_.SetParent(NULL);
}
void SignalThread::SetPriority(ThreadPriority priority) {
diff --git a/third_party/libjingle/files/talk/base/signalthread.h b/third_party/libjingle/files/talk/base/signalthread.h
index 9e6bd05..ccba912 100644
--- a/third_party/libjingle/files/talk/base/signalthread.h
+++ b/third_party/libjingle/files/talk/base/signalthread.h
@@ -73,8 +73,19 @@ private:
friend class Worker;
class Worker : public Thread {
public:
+ virtual void Run() {
+ CritScope cs(&parent_crit_);
+ if (parent_)
+ parent_->Run();
+ }
+ void SetParent(SignalThread* parent) {
+ CritScope cs(&parent_crit_);
+ parent_ = parent;
+ }
+
+ private:
SignalThread* parent_;
- virtual void Run() { parent_->Run(); }
+ CriticalSection parent_crit_;
};
void Run();