| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) 2023, The LegacyClonk Team and contributors |
| 5 | * |
| 6 | * Distributed under the terms of the ISC license; see accompanying file |
| 7 | * "COPYING" for details. |
| 8 | * |
| 9 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 10 | * See accompanying file "TRADEMARK" for details. |
| 11 | * |
| 12 | * To redistribute this file separately, substitute the full license texts |
| 13 | * for the above references. |
| 14 | */ |
| 15 | |
| 16 | #include "C4Application.h" |
| 17 | #include "C4Awaiter.h" |
| 18 | |
| 19 | bool C4Awaiter::Awaiter::ResumeInMainThread::await_ready() const noexcept |
| 20 | { |
| 21 | return Application.IsMainThread(); |
| 22 | } |
| 23 | |
| 24 | void C4Awaiter::Awaiter::ResumeInMainThread::await_suspend(const std::coroutine_handle<> handle) const noexcept |
| 25 | { |
| 26 | Application.InteractiveThread.ExecuteInMainThread(function: handle); |
| 27 | } |
| 28 | |