.reference

git-svn-id: svn://ultimatepp.org/upp/trunk@11343 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-10-01 11:47:50 +00:00
parent 8ffe7351d6
commit 3b012d281e
4 changed files with 60 additions and 0 deletions

View 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();
}

View file

@ -0,0 +1,11 @@
description "Demonstrates CoWork Cancel\377";
uses
Core;
file
CoWorkCancel.cpp;
mainconfig
"" = "";

View 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);
}
}

View file

@ -0,0 +1,11 @@
description "Demonstrates of worker thread exception handling\377";
uses
Core;
file
CoWorkExceptions.cpp;
mainconfig
"" = "";