Skip to content

Commit fbd466d

Browse files
Be less busy
1 parent cb78c27 commit fbd466d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

services/util/FlashEcho.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ namespace services
3333
if (onStopped)
3434
services::GlobalTracer().Trace() << "==== FlashEcho Stop 2";
3535

36+
busy = false;
37+
3638
if (onStopped)
3739
{
3840
services::GlobalTracer().Trace() << "==== FlashEcho Stop 3";
39-
busy = false;
4041
onStopped();
4142
}
4243
else
4344
flashResult.RequestSend([this, size]()
4445
{
4546
if (onStopped)
4647
services::GlobalTracer().Trace() << "==== FlashEcho Stop 4";
47-
busy = false;
4848
flashResult.ReadDone(infra::Head(infra::MakeRange(buffer), size));
4949
MethodDone();
5050

@@ -63,18 +63,17 @@ namespace services
6363

6464
flash.WriteBuffer(contents, address, [this]()
6565
{
66+
busy = false;
6667
if (onStopped)
6768
{
68-
services::GlobalTracer().Trace() << "==== FlashEcho Stop 6";
69-
busy = false;
69+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 6";
7070
onStopped();
7171
}
7272
else
7373
flashResult.RequestSend([this]()
7474
{
7575
if (onStopped)
7676
services::GlobalTracer().Trace() << "==== FlashEcho Stop 7";
77-
busy = false;
7877
flashResult.WriteDone();
7978
MethodDone();
8079

@@ -92,18 +91,17 @@ namespace services
9291

9392
flash.EraseSectors(sector, sector + numberOfSectors, [this]()
9493
{
94+
busy = false;
9595
if (onStopped)
9696
{
97-
services::GlobalTracer().Trace() << "==== FlashEcho Stop 9";
98-
busy = false;
97+
services::GlobalTracer().Trace() << "==== FlashEcho Stop 9";
9998
onStopped();
10099
}
101100
else
102101
flashResult.RequestSend([this]()
103102
{
104103
if (onStopped)
105104
services::GlobalTracer().Trace() << "==== FlashEcho Stop 10";
106-
busy = false;
107105
flashResult.EraseSectorsDone();
108106
MethodDone();
109107

0 commit comments

Comments
 (0)