summaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread_accessor.h
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-02-21 11:22:23 -0800
committerElliott Hughes <enh@google.com>2013-02-21 11:22:23 -0800
commitfae89fc4042ee4c360842234dfda7831c313bd44 (patch)
treeaa35c41ee98aad9b065591a5497515163534e956 /libc/bionic/pthread_accessor.h
parentccd403161cdcc88a0ffcaecd1bc707e2d4c88a1c (diff)
downloadbionic-fae89fc4042ee4c360842234dfda7831c313bd44.zip
bionic-fae89fc4042ee4c360842234dfda7831c313bd44.tar.gz
bionic-fae89fc4042ee4c360842234dfda7831c313bd44.tar.bz2
Fix raise(3) so it works in signal handlers.
We could special-case raise(3) in non-threaded programs, but the more conservative course is to make pthread_kill(3) work in signal handlers at the cost of a race shared by other C libraries. Change-Id: I59fb23d03bdabf403435e731704b33acdf3e0234
Diffstat (limited to 'libc/bionic/pthread_accessor.h')
-rw-r--r--libc/bionic/pthread_accessor.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/libc/bionic/pthread_accessor.h b/libc/bionic/pthread_accessor.h
index eb8c350..2a320f6 100644
--- a/libc/bionic/pthread_accessor.h
+++ b/libc/bionic/pthread_accessor.h
@@ -36,6 +36,14 @@ class pthread_accessor {
Unlock();
}
+ void Unlock() {
+ if (is_locked_) {
+ is_locked_ = false;
+ thread_ = NULL;
+ pthread_mutex_unlock(&gThreadListLock);
+ }
+ }
+
pthread_internal_t& operator*() const { return *thread_; }
pthread_internal_t* operator->() const { return thread_; }
pthread_internal_t* get() const { return thread_; }
@@ -49,14 +57,6 @@ class pthread_accessor {
is_locked_ = true;
}
- void Unlock() {
- if (is_locked_) {
- is_locked_ = false;
- thread_ = NULL;
- pthread_mutex_unlock(&gThreadListLock);
- }
- }
-
// Disallow copy and assignment.
pthread_accessor(const pthread_accessor&);
void operator=(const pthread_accessor&);