Use atomic exchange operations more
Some cleanups as per !2726 (merged) got merged, and I took the opportunity to refactor GCancellable internals a bit to use only atomic operations instead of relying on global mutexes (and both valgrind's drd
, thread-sanitizer and address sanitizer are green with that).
Edited by Marco Trevisan