samedi 1 octobre 2016

C++11 no matching function call for std:atomic::compare_exchange_weak

I'm trying to implement a lock free FIFO queue for an assignment. I understand that I need atomic CAS operations to achieve this. I am trying to understand the c++ 11 compare_exchange_weak() function but i get the error

'error: no matching member function for call to 'compare_exchange_weak'

atomic<uint32_t> start(10);
atomic<uint32_t> end(20);
atomic<uint32_t> next(10);
int val = start.load();
start.compare_exchange_weak(next.load(),end.load());

I'm following the tutorial on this website (http://ift.tt/1yF2q6q)

I'm on Mac OS sierra with the following compiler ->

Configured with: --prefix=/Applications/http://ift.tt/1d5DwEL --with-gxx-include-dir=/Applications/http://ift.tt/1KvS6BZ Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin16.0.0 Thread model: posix InstalledDir: /Applications/http://ift.tt/1z8WHIF

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire