mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.tutorial
git-svn-id: svn://ultimatepp.org/upp/trunk@10554 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
35e9b29e59
commit
1a77100f1e
3 changed files with 28 additions and 2 deletions
24
tutorial/CoreTutorial/Thread.cpp
Normal file
24
tutorial/CoreTutorial/Thread.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#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");
|
||||
|
||||
///
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue