Skip to content

Commit

Permalink
Make SchedulerAfterOp use InPlaceStopCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
skoppe committed Oct 9, 2023
1 parent 917030b commit 6300393
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions source/concurrency/scheduler.d
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct SchedulerAdapter(Worker) {
struct ScheduleAfterOp(Worker, Receiver) {
import std.traits : ReturnType;
import concurrency.bitfield : SharedBitField;
import concurrency.stoptoken : StopCallback, onStop;
import concurrency.stoptoken : InPlaceStopCallback, onStop;
import concurrency.receiver : setValueOrError;

enum Flags {
Expand All @@ -127,12 +127,11 @@ struct ScheduleAfterOp(Worker, Receiver) {
setup = 0x4,
}

// alias Timer = ReturnType!(Worker.addTimer);
Worker worker;
Duration dur;
Receiver receiver;
Timer timer;
StopCallback stopCb;
InPlaceStopCallback stopCb;
shared SharedBitField!Flags flags;
@disable
this(ref return scope typeof(this) rhs);
Expand All @@ -144,9 +143,8 @@ struct ScheduleAfterOp(Worker, Receiver) {
return;
}

stopCb =
receiver.getStopToken()
.onStop(cast(void delegate() nothrow @safe shared) &stop);
stopCb = InPlaceStopCallback(cast(void delegate() nothrow @safe shared) &stop);
receiver.getStopToken().onStop(stopCb);

try {
timer.userdata = cast(void delegate(TimerTrigger) @safe shared) &trigger;
Expand Down

0 comments on commit 6300393

Please sign in to comment.