/* * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include #include #include #include #include namespace NEO { class Event; class Thread; class AsyncEventsHandler { public: AsyncEventsHandler(); virtual ~AsyncEventsHandler(); void registerEvent(Event *event); void closeThread(); protected: Event *processList(); static void *asyncProcess(void *arg); void releaseEvents(); MOCKABLE_VIRTUAL void openThread(); MOCKABLE_VIRTUAL void transferRegisterList(); std::vector registerList; std::vector list; std::vector pendingList; std::unique_ptr thread; std::mutex asyncMtx; std::condition_variable asyncCond; std::atomic allowAsyncProcess; }; } // namespace NEO