/** * \file libipc/event.h * \author mutouyun (orz@orzz.org) * \brief Defines event objects for cross-process communication. */ #pragma once #include #include #include "libimp/export.h" #include "libimp/result.h" #include "libimp/span.h" #include "libipc/def.h" LIBIPC_NAMESPACE_BEG_ struct evt_handle; using evt_t = evt_handle *; /// \brief Creates or opens a named event object. LIBIMP_EXPORT ::LIBIMP::result evt_open(std::string name) noexcept; /// \brief Close the event object. LIBIMP_EXPORT ::LIBIMP::result evt_close(evt_t) noexcept; /// \brief Gets the name of the event object based on the event handle. /// \return empty string on failure. LIBIMP_EXPORT std::string evt_name(evt_t) noexcept; /// \brief Sets the event object to the signaled state. LIBIMP_EXPORT ::LIBIMP::result evt_set(evt_t) noexcept; /// \brief Waits until the specified object is in the signaled state or the time-out interval elapses. LIBIMP_EXPORT ::LIBIMP::result evt_wait(evt_t, std::int64_t ms) noexcept; /// \brief Waits until one or all of the specified objects are in the signaled state or the time-out interval elapses. LIBIMP_EXPORT ::LIBIMP::result evt_wait(::LIBIMP::span, std::int64_t ms) noexcept; /** * \brief The event object. */ class LIBIMP_EXPORT event { evt_t evt_; }; LIBIPC_NAMESPACE_END_