Giter VIP home page Giter VIP logo

Comments (4)

deviousasti avatar deviousasti commented on June 11, 2024 1

I will fix this footgun in user-land. (-__-)

from equinox.

bartelink avatar bartelink commented on June 11, 2024

Async.Parallel and AwaitTaskCorrect will never leave an orphan task running.

I can't recall which dotnet/fsharp issue covers this, but the problem here is not AwaitTaskCorrect - it's the fact that the Delay you are invoking is working as spec'd -- delaying forever. Async.Sleep, on the other hand, internally honors cancellation (because it can, via Async.CancellationToken).

Thus I'd claim this is an invalid case - if you replace B with

let B = async {
    let! ct = Async.CancellationToken
    return! Task.Delay(Timeout.Infinite, cancellationToken = ct) |> Async.AwaitTaskCorrect
}

I'm pretty sure Async.AwaitTask shares the same semantics.

from equinox.

deviousasti avatar deviousasti commented on June 11, 2024

Yes, Async.AwaitTask shares the same semantics. Which is why I'd expect AwaitTaskCorrect to improve on the semantics.
It's same story for something based on anything based on TaskCompletionSource.

from equinox.

bartelink avatar bartelink commented on June 11, 2024

Leaking unawaited Tasks on every cancellation is an acquired taste; I'd be on the side of preferring the determinism at all costs.
Things like Task.AwaitAll don't do such things
Yes, there is an argument that this can be painful in practice - e.g. like the .NET 4.0 crashing the process if a Task is unobserved, but I think the issues in dotnet/fsharp have traversed this territory far better than we'll ever do here (some are still open - it's definitely not an open and shut thing)

Bottom line in the context of the github/jet repos is that they're all designed to play well with these semantics, e.g. https://github.com/jet/propulsion/blob/master/src/Propulsion/Internal.fs#L68

from equinox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.