Hi I have a question about async in F#.
So I have a simple procedure that runs in background that is placed in a member of a type and it looks like:
type Sender() =
member this.Start(udpConectionPool) = async {
(* Some operation that continuously sends something over udp*)
} |> Async.Start
So this starts and begins to continuously sends frames over UDP without blocking rest of the program, but from time to time i want to restart thread (let us say i want to add new endpoint it would send it to that is udpConnectionPool parameter).
I was thinking about something like dumping task to member and then:
member this.Stop() = async {
do! (*stop async start member that contains task*)
}
And then I can restart this task with updated connection pool, but I don't know if I can do that.
My question is, Is it possible to stop such task, or if not is there a better way to do it?