MDEV-6693 - Atomic operations with explicit memory barrier

Added API for atomic operations with explicit memory barrier. Only gcc
atomic builtins are currently supported. If they're unavailable, fall
back to atomic operations with implicit full memory barrier.