2 #include "../acl_cpp_define.hpp" 29 T*
cas(T* cmp, T* val)
54 void set(
long long n);
55 long long cas(
long long cmp,
long long n);
56 long long fetch_add(
long long n);
57 long long add_fetch(
long long n);
59 operator long long()
const 89 long long operator--()
94 long long operator--(
int)
111 return add_fetch(-n);
116 return add_fetch(-n);
136 long long n = count_++;
137 printf(
">>n=%lld\r\n", n);
140 printf(
">>n=%lld\r\n", n);
143 printf(
">>n=%lld\r\n", n);
146 printf(
">>n=%lld\r\n", n);
149 printf(
">>n=%lld\r\n", n);
152 printf(
">>n=%lld\r\n", n);
156 printf(
">>n=%lld\r\n", n);
158 printf(
">>count > 1 ? %s\r\n", count_ >= 1 ?
"yes" :
"no");
159 printf(
">>1 > count ? %s\r\n", 1 > count_ ?
"yes" :
"no");
164 printf(
">>n=%lld\r\n", n);
175 for (
size_t i = 0; i < 100; i++)
186 mythread thr1(at), thr2(at), thr3(at);
187 thr1.set_detachable(
false);
188 thr2.set_detachable(
false);
void operator=(long long n)
long long value(void) const
bool start(bool sync=false)
long long operator+=(int n)
long long operator+=(long long n)
long long operator++(int)
void * atomic_xchg(void *, void *)
mythread(atomic_long_test &at)
void * atomic_cas(void *, void *, void *)
long long operator-=(long long n)
thread & set_detachable(bool yes)
void atomic_set(void *, void *)
long long operator-=(int n)
bool wait(void **out=NULL)
void operator=(const atomic_long &n)