diff options
author | Christopher Ferris <cferris@google.com> | 2014-11-08 15:57:11 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2014-11-14 10:46:39 -0800 |
commit | 3cdbfdce6a38cd23968d27d6e9e8d3ee65c3cf98 (patch) | |
tree | 29fa47b6c8aa35997d02c6b6c42f7cf7f3609449 /libbacktrace/BacktraceThread.h | |
parent | 6ef68b55b77b199fdcef2822750a392e1d0a4b04 (diff) | |
download | system_core-3cdbfdce6a38cd23968d27d6e9e8d3ee65c3cf98.zip system_core-3cdbfdce6a38cd23968d27d6e9e8d3ee65c3cf98.tar.gz system_core-3cdbfdce6a38cd23968d27d6e9e8d3ee65c3cf98.tar.bz2 |
Convert futex to cond wait.
Switch to the better supported pthread_cond to handle the Wait/Wake
functions.
Also, increase the number of simultaneous threads in the thread tests.
Bug: 18381207
(cherry picked from commit db44538387b08f367fc2419653639866f4c2fbd6)
Change-Id: Id326a7a7b92cb61573def3f761597c40f3ef2f4b
Diffstat (limited to 'libbacktrace/BacktraceThread.h')
-rw-r--r-- | libbacktrace/BacktraceThread.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libbacktrace/BacktraceThread.h b/libbacktrace/BacktraceThread.h index ff3e9f3..99a8638 100644 --- a/libbacktrace/BacktraceThread.h +++ b/libbacktrace/BacktraceThread.h @@ -48,8 +48,10 @@ public: inline void Lock() { pthread_mutex_lock(&mutex_); - // Reset the futex value in case of multiple unwinds of the same thread. - futex_ = 0; + + // Always reset the wait value since this could be the first or nth + // time this entry is locked. + wait_value_ = 0; } inline void Unlock() { @@ -66,9 +68,11 @@ private: pid_t pid_; pid_t tid_; - int futex_; int ref_count_; pthread_mutex_t mutex_; + pthread_mutex_t wait_mutex_; + pthread_cond_t wait_cond_; + int wait_value_; ThreadEntry* next_; ThreadEntry* prev_; ucontext_t ucontext_; |