diff options
-rw-r--r-- | includes/Atomic.h | 24 | ||||
-rw-r--r-- | src/TaskMan.cc | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/includes/Atomic.h b/includes/Atomic.h index d079967..b31c26d 100644 --- a/includes/Atomic.h +++ b/includes/Atomic.h @@ -6,20 +6,20 @@ namespace Atomic { #if (__GNUC__ >= 5) || ((__GNUC__ == 4) && ((__GNUC_MINOR__ >= 1))) // gcc version of the atomic operations -template <class T> T Or(volatile T * ptr, T mask) { __sync_or_and_fetch(ptr, mask); } -template <class T> T And(volatile T * ptr, T mask) { __sync_and_and_fetch(ptr, mask); } -template <class T> T Xor(volatile T * ptr, T mask) { __sync_xor_and_fetch(ptr, mask); } -template <class T> T Nand(volatile T * ptr, T mask) { __sync_nand_and_fetch(ptr, mask); } -template <class T> T Increment(volatile T * ptr, T delta = 1) { __sync_add_and_fetch(ptr, delta); } -template <class T> T Decrement(volatile T * ptr, T delta = 1) { __sync_sub_and_fetch(ptr, delta); } +template <class T> T Or(volatile T * ptr, T mask) { return __sync_or_and_fetch(ptr, mask); } +template <class T> T And(volatile T * ptr, T mask) { return __sync_and_and_fetch(ptr, mask); } +template <class T> T Xor(volatile T * ptr, T mask) { return __sync_xor_and_fetch(ptr, mask); } +template <class T> T Nand(volatile T * ptr, T mask) { return __sync_nand_and_fetch(ptr, mask); } +template <class T> T Increment(volatile T * ptr, T delta = 1) { return __sync_add_and_fetch(ptr, delta); } +template <class T> T Decrement(volatile T * ptr, T delta = 1) { return __sync_sub_and_fetch(ptr, delta); } namespace Prefetch { -template <class T> T Or(volatile T * ptr, T mask) { __sync_fetch_and_or(ptr, mask); } -template <class T> T And(volatile T * ptr, T mask) { __sync_fetch_and_and(ptr, mask); } -template <class T> T Xor(volatile T * ptr, T mask) { __sync_fetch_and_xor(ptr, mask); } -template <class T> T Nand(volatile T * ptr, T mask) { __sync_fetch_and_nand(ptr, mask); } -template <class T> T Increment(volatile T * ptr, T delta = 1) { __sync_fetch_and_add(ptr, delta); } -template <class T> T Decrement(volatile T * ptr, T delta = 1) { __sync_fetch_and_sub(ptr, delta); } +template <class T> T Or(volatile T * ptr, T mask) { return __sync_fetch_and_or(ptr, mask); } +template <class T> T And(volatile T * ptr, T mask) { return __sync_fetch_and_and(ptr, mask); } +template <class T> T Xor(volatile T * ptr, T mask) { return __sync_fetch_and_xor(ptr, mask); } +template <class T> T Nand(volatile T * ptr, T mask) { return __sync_fetch_and_nand(ptr, mask); } +template <class T> T Increment(volatile T * ptr, T delta = 1) { return __sync_fetch_and_add(ptr, delta); } +template <class T> T Decrement(volatile T * ptr, T delta = 1) { return __sync_fetch_and_sub(ptr, delta); } }; template <class T> T CmpXChgVal(volatile T * ptr, const T xch, const T cmp) { return __sync_val_compare_and_swap(ptr, cmp, xch); } diff --git a/src/TaskMan.cc b/src/TaskMan.cc index 25b3eaa..393eb57 100644 --- a/src/TaskMan.cc +++ b/src/TaskMan.cc @@ -311,6 +311,7 @@ class ThreadedTaskMan : public Balau::Thread { virtual void * proc() { m_taskMan = new Balau::TaskMan(); m_taskMan->mainLoop(); + return NULL; } Balau::TaskMan * m_taskMan; }; @@ -318,4 +319,5 @@ class ThreadedTaskMan : public Balau::Thread { Balau::Thread * Balau::TaskMan::createThreadedTaskMan() { Thread * r = new ThreadedTaskMan(); r->threadStart(); + return r; } |