add general async swap

This commit is contained in:
2019-07-10 23:33:46 +02:00
parent f5d885a3f4
commit 80b9a4d281
3 changed files with 22 additions and 8 deletions

View File

@@ -178,6 +178,7 @@ public:
void async_start();
void async_update();
void async_redraw();
void async_swap();
void async_end();
void resize(float w, float h);
void show_cursor();
@@ -272,7 +273,7 @@ public:
// don't capture a reference to this ptr as the object may be destroyed
// by the time the task is executed
template<typename T, typename R = std::result_of<T()>::type>
template<typename T, typename R = void>
std::future<R> render_task_async(T task)
{
#ifdef _WIN32
@@ -294,7 +295,7 @@ public:
#endif // _WIN32
}
template<typename T, typename R = std::result_of<T()>::type>
template<typename T, typename R = void>
R render_task(T task)
{
#ifdef _WIN32
@@ -342,7 +343,7 @@ public:
// don't capture a reference to this ptr as the object may be destroyed
// by the time the task is executed
template<typename T, typename R = std::result_of<T()>::type>
template<typename T, typename R = void>
std::future<R> ui_task_async(T task)
{
std::packaged_task<R()> pt(task);
@@ -362,7 +363,7 @@ public:
return f;
}
template<typename T, typename R = std::result_of<T()>::type>
template<typename T, typename R = void>
R ui_task(T task)
{
std::packaged_task<R()> pt(task);