mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 22:02:49 -06:00
24 lines
No EOL
400 B
C++
24 lines
No EOL
400 B
C++
#include "Tutorial.h"
|
|
|
|
void ThreadTutorial()
|
|
{
|
|
/// .Thread
|
|
|
|
Thread t;
|
|
t.Run([] {
|
|
for(int i = 0; i < 10; i++) {
|
|
LOG("In the thread " << i);
|
|
Sleep(100);
|
|
}
|
|
LOG("Thread is ending...");
|
|
});
|
|
for(int i = 0; i < 5; i++) {
|
|
LOG("In the main thread " << i);
|
|
Sleep(100);
|
|
}
|
|
LOG("About to wait for thread to finish");
|
|
t.Wait();
|
|
LOG("Wait for thread done");
|
|
|
|
///
|
|
} |