mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@11343 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
8ffe7351d6
commit
3b012d281e
4 changed files with 60 additions and 0 deletions
22
reference/CoWorkCancel/CoWorkCancel.cpp
Normal file
22
reference/CoWorkCancel/CoWorkCancel.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
CoWork co;
|
||||
for(int i = 0; i < 50; i++)
|
||||
co & [] {
|
||||
for(;;) {
|
||||
if(CoWork::IsCanceled()) {
|
||||
LOG("CoWork was canceled");
|
||||
return;
|
||||
}
|
||||
Sleep(1);
|
||||
}
|
||||
};
|
||||
Sleep(100);
|
||||
co.Cancel();
|
||||
}
|
||||
11
reference/CoWorkCancel/CoWorkCancel.upp
Normal file
11
reference/CoWorkCancel/CoWorkCancel.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Demonstrates CoWork Cancel\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
CoWorkCancel.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
16
reference/CoWorkExceptions/CoWorkExceptions.cpp
Normal file
16
reference/CoWorkExceptions/CoWorkExceptions.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
try {
|
||||
CoWork co;
|
||||
co & [] { throw "Worker exception"; };
|
||||
}
|
||||
catch(const char *s) {
|
||||
LOG("Caught: " << s);
|
||||
}
|
||||
}
|
||||
11
reference/CoWorkExceptions/CoWorkExceptions.upp
Normal file
11
reference/CoWorkExceptions/CoWorkExceptions.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Demonstrates of worker thread exception handling\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
CoWorkExceptions.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue