Hermes
0.7.0
Linux game streaming host
Toggle main menu visibility
Loading...
Searching...
No Matches
pyrowave_fence.h
1
#pragma once
2
3
#include <algorithm>
4
#include <cerrno>
5
#include <chrono>
6
#include <cstdint>
7
#include <poll.h>
8
9
namespace
pyrowave {
10
// A failed Vulkan semaphore import must still wait for conversion to finish.
11
// EINTR does not renew the deadline; a timeout/error must drop the frame.
12
inline
bool
wait_for_conversion_fence(
int
fd, std::chrono::milliseconds timeout) {
13
const
auto
deadline = std::chrono::steady_clock::now() +
timeout
;
14
for
(;;) {
15
const
auto
left = deadline - std::chrono::steady_clock::now();
16
if
(left <= std::chrono::steady_clock::duration::zero())
return
false
;
17
const
auto
milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(left).count();
18
pollfd fence {fd, POLLIN, 0};
19
const
int
result = ::poll(&fence, 1,
static_cast<
int
>
(std::max<std::int64_t>(1, milliseconds)));
20
if
(result > 0)
return
(fence.revents & POLLIN) && !(fence.revents & (POLLERR | POLLHUP | POLLNVAL));
21
if
(result == 0 || errno != EINTR)
return
false
;
22
}
23
}
24
}
platf::capture_e::timeout
@ timeout
Timeout.
Definition
common.h:438
src
platform
linux
pyrowave_fence.h
Generated by
1.18.0