Core: CoWorkNX (without noexcept(false) destructor)

git-svn-id: svn://ultimatepp.org/upp/trunk@12485 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-11-08 11:58:52 +00:00
parent 419f9e44e3
commit af93b0fcdc
3 changed files with 22 additions and 3 deletions

View file

@ -105,6 +105,10 @@ public:
~CoWork() noexcept(false);
};
struct CoWorkNX : CoWork {
~CoWorkNX() noexcept(true) {}
};
template <class T>
class CoWorkerResources {
int workercount;

View file

@ -1,5 +1,4 @@
topic "CoWork";
[2 $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
@ -9,7 +8,9 @@ topic "CoWork";
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[2 $$0,0#00000000000000000000000000000000:Default]
[{_}
[s0; &]
[ {{10000@(113.42.0) [s0;%% [*@7;4 CoWork]]}}&]
[s3; &]
[s1;:CoWork`:`:class: [@(0.0.255)3 class][3 _][*3 CoWork]&]
@ -30,7 +31,10 @@ from various threads (CoWork is internally synchronized).&]
[s9;%% If an exception is thrown in worker thread, which is not handled
by worker thread, it is caught and rethrown in CoWork thread
in Finish routine. Any such exception also causes the Cancel
of the CoWork.&]
of the CoWork. For this reason, CoWork destructor [*/ CAN] throw
exceptions and CoWork should be usually used as automatick (stack)
variable. If you need CoWork that does not throw exceptions in
destructor, use CoWorkNX.&]
[s9;%% [*/ Implementation notes: ]Current implementation has single
global FIFO stack for 2048 scheduled jobs. When there is no slot
available when scheduling the job, it is performed immediately
@ -178,6 +182,17 @@ nt]_[*@3 n])&]
`+ 2).&]
[s0; &]
[s0; &]
[ {{10000@(113.42.0) [s0;%% [*@7;4 CoWorkNX]]}}&]
[s0; &]
[s1;:Upp`:`:CoWorkNX`:`:struct: [@(0.0.255)3 struct][3 _][*3 CoWorkNX][3 _:_][@(0.0.255)3 public
][3 _][*@3;3 CoWork]&]
[s2;%% This simple helper class just removes `"noexcept(false)`"
from CoWork destructor, removing exception throws from the destructor
and allowing it to be used as member variable. Obviously, if
exception handling is required, you need to use Finish (not depend
on destructor to call it).&]
[s0; &]
[s0; &]
[ {{10000@(113.42.0) [s0;%% [*@7;4 CoWorkerResources]]}}&]
[s3; &]
[s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 T][3 >]&]

View file

@ -163,7 +163,7 @@ Buffer<ClippingLine> BufferPainter::RenderPath(double width, Event<One<SpanSourc
job.path_min = path_min;
job.path_max = path_max;
current = Null;
if(jobcount >= 1024) {
if(jobcount >= 256) {
LDUMP("Finish A");
Finish();
}