summaryrefslogtreecommitdiffstats
path: root/include/utils
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-06-02 08:59:28 -0700
committerGlenn Kasten <gkasten@google.com>2011-06-10 17:07:46 -0700
commitd9e1bb76fe1e01fb79bb65959b92051aa18fddbe (patch)
tree01d4ae97d8d952940f8b48c47b7f670315756e9b /include/utils
parent53df9ca28f6cfe9acf897579985ef6fcde13cb21 (diff)
downloadframeworks_native-d9e1bb76fe1e01fb79bb65959b92051aa18fddbe.zip
frameworks_native-d9e1bb76fe1e01fb79bb65959b92051aa18fddbe.tar.gz
frameworks_native-d9e1bb76fe1e01fb79bb65959b92051aa18fddbe.tar.bz2
Remove redundant memory barrier
pthread_create already includes the necessary memory barriers: - parent at pthread_create : pthread_mutex_unlock(start_mutex) - child at __thread_entry : pthread_mutex_lock(start_mutex) Add lock around uses of mThread. Added comments: - uses of mThread require lock - androidCreateRawThreadEtc returned ID is not safe for direct use from non-parent threads. Change-Id: I18cb296b41ddaf64cf127b57aab31154319b5970
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/threads.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/utils/threads.h b/include/utils/threads.h
index 41e5766..0bd69cf 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -526,6 +526,7 @@ private:
Thread& operator=(const Thread&);
static int _threadLoop(void* user);
const bool mCanCallJava;
+ // always hold mLock when reading or writing
thread_id_t mThread;
mutable Mutex mLock;
Condition mThreadExitedCondition;