Skip to content
Snippets Groups Projects
Commit 4d2ef690 authored by Johann Lombardi's avatar Johann Lombardi
Browse files

Branch b1_6

b=13843
i=adilger
i=nathan

Dynamically create DLM blocking callback threads
+ fix an issue with MacOS implementation of atomic_sub_and_test().
parent 8fff6d65
No related merge requests found
......@@ -64,6 +64,7 @@ typedef struct { volatile uint32_t counter; } atomic_t;
#define atomic_read(a) ((a)->counter)
#define atomic_set(a, v) (((a)->counter) = (v))
#ifdef __DARWIN8__
/* OS*Atomic return the value before the operation */
#define atomic_add(v, a) OSAddAtomic(v, (SInt32 *)&((a)->counter))
#define atomic_sub(v, a) OSAddAtomic(-(v), (SInt32 *)&((a)->counter))
#define atomic_inc(a) OSIncrementAtomic((SInt32 *)&((a)->counter))
......@@ -74,8 +75,10 @@ typedef struct { volatile uint32_t counter; } atomic_t;
#define atomic_inc(a) atomic_add(1, a)
#define atomic_dec(a) atomic_sub(1, a)
#endif /* !__DARWIN8__ */
#define atomic_sub_and_test(v, a) ( atomic_sub(v, a) == -(a) )
#define atomic_dec_and_test(a) ( atomic_dec(a) == 1 )
#define atomic_sub_and_test(v, a) (atomic_sub(v, a) == (v))
#define atomic_dec_and_test(a) (atomic_dec(a) == 1)
#define atomic_inc_return(a) (atomic_inc(a) + 1)
#define atomic_dec_return(a) (atomic_dec(a) - 1)
#include <libsa/mach/mach.h>
typedef off_t loff_t;
......
......@@ -187,6 +187,8 @@ typedef struct { volatile int counter; } atomic_t;
#define atomic_inc(a) (((a)->counter)++)
#define atomic_dec(a) do { (a)->counter--; } while (0)
#define atomic_add(b,a) do {(a)->counter += b;} while (0)
#define atomic_add_return(n,a) ((a)->counter = n)
#define atomic_inc_return(a) atomic_add_return(1,a)
#define atomic_sub(b,a) do {(a)->counter -= b;} while (0)
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment