Skip to content

Instantly share code, notes, and snippets.

@Zaryob
Created February 26, 2025 21:53
Show Gist options
  • Save Zaryob/f5b5ff02f348938125f3e4b634161108 to your computer and use it in GitHub Desktop.
Save Zaryob/f5b5ff02f348938125f3e4b634161108 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <future>
#include <coroutine>
std::future<void> asyncPrint(int value) {
std::cout << "İşleniyor: " << value << std::endl;
co_await std::suspend_always{};
std::cout << "Tamamlandı: " << value << std::endl;
}
int main() {
auto result = asyncPrint(42);
result.wait();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment