Atomic: cleanup and add more operations
authorest31 <MTest31@outlook.com>
Tue, 3 Nov 2015 12:09:23 +0000 (13:09 +0100)
committerest31 <MTest31@outlook.com>
Tue, 3 Nov 2015 18:07:39 +0000 (19:07 +0100)
commitabc354a5d0a941cf1f3877e487cce325cc609ba8
tree2989b4a84d559c498b09ee485a6c5dcc7aa88f93
parent1550ab3c5d17787bcb9885c045db2f07aa4971ac
Atomic: cleanup and add more operations

Cleanup:
* Remove volatile keyword, it is of no use at all. [1]
* Remove the enable_if stuff. It had no use either.
  The most likely explanation why the enable_if stuff was there is that it
  was used as something like a STATIC_ASSERT to verify that sizeof(T) is not larger
  than sizeof(void *). This check however is not just misplaced in a place where we
  already use a lock, it isn't needed at all, as gcc will just generate a call to
  to the runtime if it compiles for platforms that don't support atomic instructions.
  The runtime will then most likely use locks.

Code style fixes:
* Prefix name of the mutex
* Line everything up nicely, where it makes things look nice
* Filling \ continuations with spaces is code style rule

Added operations on the atomic var:
* Compare and swap
* Swap

The second point of the cleanup also fixes the Android build of the next commit.

[1]: http://stackoverflow.com/q/2484980
src/threading/atomic.h