summaryrefslogtreecommitdiff
path: root/src/atomic.h
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2022-10-29 23:48:50 +0900
committerRyo Nakamura <upa@haeena.net>2022-10-29 23:48:50 +0900
commitc76fa3141dd648b145dde2534a1ca3824ff81466 (patch)
tree6be1bc1f5ce8c0a200b65cba34987b1df2844239 /src/atomic.h
parentff697aa514b13cbb8105f2f3c04c1889820796d9 (diff)
change indent from space to tab
Diffstat (limited to 'src/atomic.h')
-rw-r--r--src/atomic.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/atomic.h b/src/atomic.h
index 4f643e9..e0e735d 100644
--- a/src/atomic.h
+++ b/src/atomic.h
@@ -9,12 +9,12 @@ typedef int refcnt;
static inline void refcnt_inc(refcnt *cnt)
{
- __sync_add_and_fetch(cnt, 1);
+ __sync_add_and_fetch(cnt, 1);
}
static inline refcnt refcnt_dec(refcnt *cnt)
{
- return __sync_sub_and_fetch(cnt, 1);
+ return __sync_sub_and_fetch(cnt, 1);
}
@@ -22,37 +22,37 @@ typedef pthread_mutex_t lock;
static inline void lock_init(lock *l)
{
- pthread_mutex_init(l, NULL);
+ pthread_mutex_init(l, NULL);
}
static inline void lock_acquire(lock *l)
{
- int ret = pthread_mutex_lock(l);
- if (ret < 0) {
- switch (ret) {
- case EINVAL:
- pr_err("invalid mutex\n");
- exit(1);
- case EDEADLK:
- pr_err("a deadlock would occur\n");
- exit(1);
- }
- }
+ int ret = pthread_mutex_lock(l);
+ if (ret < 0) {
+ switch (ret) {
+ case EINVAL:
+ pr_err("invalid mutex\n");
+ exit(1);
+ case EDEADLK:
+ pr_err("a deadlock would occur\n");
+ exit(1);
+ }
+ }
}
static inline void lock_release(lock *l)
{
- int ret = pthread_mutex_unlock(l);
- if (ret < 0) {
- switch (ret) {
- case EINVAL:
- pr_err("invalid mutex\n");
- exit(1);
- case EPERM:
- pr_err("this thread does not hold this mutex\n");
- exit(1);
- }
- }
+ int ret = pthread_mutex_unlock(l);
+ if (ret < 0) {
+ switch (ret) {
+ case EINVAL:
+ pr_err("invalid mutex\n");
+ exit(1);
+ case EPERM:
+ pr_err("this thread does not hold this mutex\n");
+ exit(1);
+ }
+ }
}
#endif /* _ATOMIC_H_ */