Home » Community » Newbie corner » Simple Thread (simple thread example.)
Re: Simple Thread [message #55033 is a reply to message #55023] |
Mon, 05 October 2020 19:04   |
Oblivion
Messages: 1214 Registered: August 2007
|
Senior Contributor |
|
|
Klugier has put it nicely.
However, there is an even simpler way if you need async behaviour, using AsyncWork worker threads.
CONSOLE_APP_MAIN
{
auto Boucle = [](String parametres) -> void
{
for (int i = 0; i < parametres.GetLength(); ++i)
{
Cout() << String(parametres[i], 1) << ",";
}
};
Async(Boucle, "Hello world").Get();
}
Note that AsyncWork is the Upp interpretation and implementation of future/promise pattern and there are other ways to utilize it.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Mon, 05 October 2020 19:25] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Jul 07 02:28:36 CEST 2025
Total time taken to generate the page: 0.03612 seconds
|