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

Unified Diff: fusl/src/thread/sem_trywait.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 side-by-side diff with in-line comments
Download patch
Index: fusl/src/thread/sem_trywait.c
diff --git a/fusl/src/thread/sem_trywait.c b/fusl/src/thread/sem_trywait.c
index 04edf46b524de72a575b1db7687f56d93fc1e291..98998a63afed2242a1b29008e9b09179441958ff 100644
--- a/fusl/src/thread/sem_trywait.c
+++ b/fusl/src/thread/sem_trywait.c
@@ -1,13 +1,13 @@
#include <semaphore.h>
#include "pthread_impl.h"
-int sem_trywait(sem_t *sem)
-{
- int val;
- while ((val=sem->__val[0]) > 0) {
- int new = val-1-(val==1 && sem->__val[1]);
- if (a_cas(sem->__val, val, new)==val) return 0;
- }
- errno = EAGAIN;
- return -1;
+int sem_trywait(sem_t* sem) {
+ int val;
+ while ((val = sem->__val[0]) > 0) {
+ int new = val - 1 - (val == 1 && sem->__val[1]);
+ if (a_cas(sem->__val, val, new) == val)
+ return 0;
+ }
+ errno = EAGAIN;
+ return -1;
}

Powered by Google App Engine
This is Rietveld 408576698