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

Side by Side Diff: fusl/src/thread/mtx_trylock.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 #include <threads.h> 2 #include <threads.h>
3 3
4 int __pthread_mutex_trylock(mtx_t *); 4 int __pthread_mutex_trylock(mtx_t*);
5 5
6 int mtx_trylock(mtx_t *m) 6 int mtx_trylock(mtx_t* m) {
7 { 7 if (m->_m_type == PTHREAD_MUTEX_NORMAL)
8 » if (m->_m_type == PTHREAD_MUTEX_NORMAL) 8 return (a_cas(&m->_m_lock, 0, EBUSY) & EBUSY) ? thrd_busy : thrd_success;
9 » » return (a_cas(&m->_m_lock, 0, EBUSY) & EBUSY) ? thrd_busy : thrd _success;
10 9
11 » int ret = __pthread_mutex_trylock(m); 10 int ret = __pthread_mutex_trylock(m);
12 » switch (ret) { 11 switch (ret) {
13 » default: return thrd_error; 12 default:
14 » case 0: return thrd_success; 13 return thrd_error;
15 » case EBUSY: return thrd_busy; 14 case 0:
16 » } 15 return thrd_success;
16 case EBUSY:
17 return thrd_busy;
18 }
17 } 19 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698