diff --git a/include/MacStd/dispatch.hpp b/include/MacStd/dispatch.hpp new file mode 100644 index 0000000..5905f44 --- /dev/null +++ b/include/MacStd/dispatch.hpp @@ -0,0 +1,42 @@ +/* + SPDX-License-Identifier: MIT + Copyright © 2025 Amebis +*/ + +#pragma once + +#include "common.hpp" +#include + +namespace macstd { + /// + /// Dispatch object traits + /// + struct dispatch_traits + { + static inline constexpr dispatch_source_t invalid = static_cast(NULL); + + /// + /// Decrements the reference count (the retain count) of a dispatch object + /// + /// \sa [dispatch_release function](https://developer.apple.com/documentation/dispatch/1496328-dispatch_release) + /// + static void free(dispatch_source_t h) noexcept + { + dispatch_release(h); + } + + private: + static dispatch_source_t duplicate(dispatch_source_t h); + }; + + /// + /// Dispatch event source + /// + using dispatch_source = handle; + + /// + /// Dispatch event source + /// + using dispatch_queue = handle; +}