summaryrefslogtreecommitdiff
path: root/src/atomic.h
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2024-02-06 23:09:59 +0900
committerRyo Nakamura <upa@haeena.net>2024-02-06 23:09:59 +0900
commit93f155cffe45e1438e316ed84dcd1bd5215c8030 (patch)
tree06fa8aac9d9cb8f5ff3dd55581b80fc8e53b1a43 /src/atomic.h
parent4f0669f8f86acb09f10ffb5af273f86d8d6ddd34 (diff)
add .clang-format from Linux kernel and format sources
The exception is that ColumnLimit is 90.
Diffstat (limited to 'src/atomic.h')
-rw-r--r--src/atomic.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/atomic.h b/src/atomic.h
index 33d39d9..cf018d7 100644
--- a/src/atomic.h
+++ b/src/atomic.h
@@ -18,7 +18,6 @@ static inline refcnt refcnt_dec(refcnt *cnt)
return __sync_sub_and_fetch(cnt, 1);
}
-
/* mutex */
typedef pthread_mutex_t lock;
@@ -45,14 +44,11 @@ static inline void lock_release_via_cleanup(void *l)
lock_release(l);
}
-#define LOCK_ACQUIRE(l) \
- lock_acquire(l); \
+#define LOCK_ACQUIRE(l) \
+ lock_acquire(l); \
pthread_cleanup_push(lock_release_via_cleanup, l)
-#define LOCK_RELEASE() \
- pthread_cleanup_pop(1)
-
-
+#define LOCK_RELEASE() pthread_cleanup_pop(1)
/* read/write lock */
typedef pthread_rwlock_t rwlock;
@@ -85,18 +81,14 @@ static inline void rwlock_release_via_cleanup(void *rw)
rwlock_release(rw);
}
-#define RWLOCK_READ_ACQUIRE(rw) \
- rwlock_read_acquire(rw); \
+#define RWLOCK_READ_ACQUIRE(rw) \
+ rwlock_read_acquire(rw); \
pthread_cleanup_push(rwlock_release_via_cleanup, rw)
-#define RWLOCK_WRITE_ACQUIRE(rw) \
- rwlock_write_acquire(rw); \
+#define RWLOCK_WRITE_ACQUIRE(rw) \
+ rwlock_write_acquire(rw); \
pthread_cleanup_push(rwlock_release_via_cleanup, rw)
-
-#define RWLOCK_RELEASE() \
- pthread_cleanup_pop(1)
-
-
+#define RWLOCK_RELEASE() pthread_cleanup_pop(1)
#endif /* _ATOMIC_H_ */