Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: fusl/src/thread/pthread_mutex_unlock.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "pthread_impl.h" 1 #include "pthread_impl.h"
2 2
3 int __pthread_mutex_unlock(pthread_mutex_t *m) 3 int __pthread_mutex_unlock(pthread_mutex_t* m) {
4 { 4 pthread_t self;
5 » pthread_t self; 5 int waiters = m->_m_waiters;
6 » int waiters = m->_m_waiters; 6 int cont;
7 » int cont; 7 int type = m->_m_type & 15;
8 » int type = m->_m_type & 15; 8 int priv = (m->_m_type & 128) ^ 128;
9 » int priv = (m->_m_type & 128) ^ 128;
10 9
11 » if (type != PTHREAD_MUTEX_NORMAL) { 10 if (type != PTHREAD_MUTEX_NORMAL) {
12 » » self = __pthread_self(); 11 self = __pthread_self();
13 » » if ((m->_m_lock&0x7fffffff) != self->tid) 12 if ((m->_m_lock & 0x7fffffff) != self->tid)
14 » » » return EPERM; 13 return EPERM;
15 » » if ((type&3) == PTHREAD_MUTEX_RECURSIVE && m->_m_count) 14 if ((type & 3) == PTHREAD_MUTEX_RECURSIVE && m->_m_count)
16 » » » return m->_m_count--, 0; 15 return m->_m_count--, 0;
17 » » if (!priv) { 16 if (!priv) {
18 » » » self->robust_list.pending = &m->_m_next; 17 self->robust_list.pending = &m->_m_next;
19 » » » __vm_lock(); 18 __vm_lock();
20 » » } 19 }
21 » » volatile void *prev = m->_m_prev; 20 volatile void* prev = m->_m_prev;
22 » » volatile void *next = m->_m_next; 21 volatile void* next = m->_m_next;
23 » » *(volatile void *volatile *)prev = next; 22 *(volatile void* volatile*)prev = next;
24 » » if (next != &self->robust_list.head) *(volatile void *volatile * ) 23 if (next != &self->robust_list.head)
25 » » » ((char *)next - sizeof(void *)) = prev; 24 *(volatile void* volatile*)((char*)next - sizeof(void*)) = prev;
26 » } 25 }
27 » cont = a_swap(&m->_m_lock, (type & 8) ? 0x40000000 : 0); 26 cont = a_swap(&m->_m_lock, (type & 8) ? 0x40000000 : 0);
28 » if (type != PTHREAD_MUTEX_NORMAL && !priv) { 27 if (type != PTHREAD_MUTEX_NORMAL && !priv) {
29 » » self->robust_list.pending = 0; 28 self->robust_list.pending = 0;
30 » » __vm_unlock(); 29 __vm_unlock();
31 » } 30 }
32 » if (waiters || cont<0) 31 if (waiters || cont < 0)
33 » » __wake(&m->_m_lock, 1, priv); 32 __wake(&m->_m_lock, 1, priv);
34 » return 0; 33 return 0;
35 } 34 }
36 35
37 weak_alias(__pthread_mutex_unlock, pthread_mutex_unlock); 36 weak_alias(__pthread_mutex_unlock, pthread_mutex_unlock);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698