//
//  Nonblocking.hpp
//  SwitchboardSDK
//

#pragma once

// Clang function-effects / RealtimeSanitizer annotation. Apply to lock-free, allocation-free
// methods that may run on the realtime audio thread so their non-blocking contract can be
// statically verified (-Wfunction-effects) and checked at runtime (-fsanitize=realtime). Apply it
// to BOTH the declaration and the definition. Expands to nothing on toolchains without the
// attribute.
//
// Named distinctly from the SDK's NONBLOCKING macro to avoid a redefinition clash, since this
// header can be included before SwitchboardCore.hpp.
#if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::nonblocking)
#define SWITCHBOARD_AUDIO_NONBLOCKING [[clang::nonblocking]]
#else
#define SWITCHBOARD_AUDIO_NONBLOCKING
#endif
