Files
compute-runtime/opencl/source/event/async_events_handler.h
kamdiedrich fa8e720f9e Reorganization directory structure [1/n]
Change-Id: Id1a94577437a4826a32411869f516fec20314ec0
2020-02-22 21:56:09 +01:00

42 lines
880 B
C++

/*
* Copyright (C) 2017-2020 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