Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #229 Cancel an operation

Interrupt an ongoing processing p.

import "context"
ctx, cancel := context.WithCancel(context.Background())
go p(ctx)

somethingElse()

cancel()
uses Process;
var
  P: TProcess;
begin
  ...
  P.Execute;
  //do something else
  P.Terminate(0);
end.

New implementation...
< >
programming-idioms.org