1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#include "deviceEvent.hpp"
#include "deviceStream.hpp"
#include "cuda/error.hpp"
namespace VideoStitch {
namespace GPU {
Event::Event() : pimpl(nullptr) {}
Event::Event(DeviceEvent* pimpl) : pimpl(pimpl) {}
Event::Event(const Event& other) : pimpl(other.pimpl ? new DeviceEvent(*other.pimpl) : nullptr) {}
Event::~Event() {
delete pimpl;
pimpl = nullptr;
}
Status Event::synchronize() { return CUDA_ERROR(cudaEventSynchronize(*(pimpl->event))); }
Event Event::DeviceEvent::create(cudaEvent_t cudaEvent) {
DeviceEvent* dve = new DeviceEvent(cudaEvent);
return Event(dve);
}
const Event::DeviceEvent& Event::get() const {
assert(pimpl);
return *pimpl;
}
} // namespace GPU
} // namespace VideoStitch