Chromium Code Reviews

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

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « fusl/src/thread/mtx_timedlock.c ('k') | fusl/src/thread/mtx_unlock.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "pthread_impl.h"
2 #include <threads.h>
3
4 int __pthread_mutex_trylock(mtx_t *);
5
6 int mtx_trylock(mtx_t *m)
7 {
8 if (m->_m_type == PTHREAD_MUTEX_NORMAL)
9 return (a_cas(&m->_m_lock, 0, EBUSY) & EBUSY) ? thrd_busy : thrd _success;
10
11 int ret = __pthread_mutex_trylock(m);
12 switch (ret) {
13 default: return thrd_error;
14 case 0: return thrd_success;
15 case EBUSY: return thrd_busy;
16 }
17 }
OLDNEW
« no previous file with comments | « fusl/src/thread/mtx_timedlock.c ('k') | fusl/src/thread/mtx_unlock.c » ('j') | no next file with comments »

Powered by Google App Engine