Files
compute-runtime/runtime/event/async_events_handler.h
Maciej Plewka 9e52684f5b Change namespace from OCLRT to NEO
Change-Id: If965c79d70392db26597aea4c2f3b7ae2820fe96
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
2019-03-26 15:48:19 +01:00

42 lines
880 B
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <atomic>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <vector>
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<Event *> registerList;
std::vector<Event *> list;
std::vector<Event *> pendingList;
std::unique_ptr<Thread> thread;
std::mutex asyncMtx;
std::condition_variable asyncCond;
std::atomic<bool> allowAsyncProcess;
};
} // namespace NEO