diff options
author | Steve Block <steveblock@google.com> | 2011-10-07 12:07:59 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-07 12:07:59 -0700 |
commit | 9f45a7084c55faadcff20259d453c0b1178ca391 (patch) | |
tree | 571364963e8fdb229661a67dc8b095498633f5e8 | |
parent | 88ef38cdd023acbb2922a25613ffea676777f2e6 (diff) | |
parent | 28480d4f48373da735986b2a75e099d3cfddab3e (diff) | |
download | external_chromium-9f45a7084c55faadcff20259d453c0b1178ca391.zip external_chromium-9f45a7084c55faadcff20259d453c0b1178ca391.tar.gz external_chromium-9f45a7084c55faadcff20259d453c0b1178ca391.tar.bz2 |
am 28480d4f: Add more logging to Thread and WaitableEvent to help debugging
* commit '28480d4f48373da735986b2a75e099d3cfddab3e':
Add more logging to Thread and WaitableEvent to help debugging
-rw-r--r-- | base/synchronization/waitable_event_posix.cc | 9 | ||||
-rw-r--r-- | base/threading/thread.cc | 27 |
2 files changed, 36 insertions, 0 deletions
diff --git a/base/synchronization/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc index ae03ead..640026b 100644 --- a/base/synchronization/waitable_event_posix.cc +++ b/base/synchronization/waitable_event_posix.cc @@ -150,7 +150,16 @@ class SyncWaiter : public WaitableEvent::Waiter { }; bool WaitableEvent::Wait() { +#if defined(ANDROID) + // For debugging. See http://b/5244039 + bool result = TimedWait(TimeDelta::FromSeconds(-1)); + if (!result) { + LOG(INFO) << "TimedWait() with infinite timeout should never fail!"; + } + return result; +#else return TimedWait(TimeDelta::FromSeconds(-1)); +#endif } bool WaitableEvent::TimedWait(const TimeDelta& max_time) { diff --git a/base/threading/thread.cc b/base/threading/thread.cc index cf5fc45..2f10adf 100644 --- a/base/threading/thread.cc +++ b/base/threading/thread.cc @@ -69,6 +69,12 @@ bool Thread::StartWithOptions(const Options& options) { SetThreadWasQuitProperly(false); StartupData startup_data(options); +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "StartWithOptions() created startup_data, this=" << this + << ", startup_data.event.IsSignaled()=" + << startup_data.event.IsSignaled(); +#endif startup_data_ = &startup_data; if (!PlatformThread::Create(options.stack_size, this, &thread_)) { @@ -83,11 +89,20 @@ bool Thread::StartWithOptions(const Options& options) { } // Wait for the thread to start and initialize message_loop_ +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "StartWithOptions() waiting for thread to start, this=" << this + << ", startup_data.event.IsSignaled()=" + << startup_data.event.IsSignaled(); +#endif startup_data.event.Wait(); // set it to NULL so we don't keep a pointer to some object on the stack. #if defined(ANDROID) // For debugging. See http://b/5244039 + LOG(INFO) << "StartWithOptions() clearing startup_data_, this=" << this + << ", startup_data.event.IsSignaled()=" + << startup_data.event.IsSignaled(); startup_data_ = reinterpret_cast<StartupData*>(0xbbadbeef); #else startup_data_ = NULL; @@ -152,6 +167,12 @@ bool Thread::GetThreadWasQuitProperly() { void Thread::ThreadMain() { { +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "ThreadMain() starting, this=" << this + << ", startup_data_->event.IsSignaled()=" + << startup_data_->event.IsSignaled(); +#endif // The message loop for this thread. MessageLoop message_loop(startup_data_->options.message_loop_type); @@ -167,6 +188,12 @@ void Thread::ThreadMain() { // Let's do this before signaling we are started. Init(); +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "ThreadMain() signalling, this=" << this + << ", startup_data_->event.IsSignaled()=" + << startup_data_->event.IsSignaled(); +#endif startup_data_->event.Signal(); // startup_data_ can't be touched anymore since the starting thread is now // unlocked. |