• RustyNova@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    Honestly I can’t wrap my head how to effectively put computation into a thread, even with Tokio.

    All I want is something like rayon where you got a task queue and you just yeet tasks into a free thread, and await when you actually need it

    Might be too much JS/TS influence on me, or that I can’t find a tutorial that would explain in a way that clicks for me

    • PlexSheep@feddit.de
      link
      fedilink
      arrow-up
      0
      ·
      9 months ago

      Tokio is for concurrency, not parallelism. Use it for IO stuff. They say rayon is good for that, but I haven’t used that. If you just want something simple, I’d recommend working with threadpool.