Giter Site home page Giter Site logo

iq-scm / threadfin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sagebind/threadfin

0.0 0.0 0.0 56 KB

A thread pool for running multiple tasks on a configurable group of threads.

Home Page: https://docs.rs/threadfin/

License: MIT License

Rust 100.00%

threadfin's Introduction

Threadfin

A thread pool for running multiple tasks on a configurable group of threads.

Crates.io Documentation License Minimum supported Rust version Build

Extra features:

  • Dynamic pool size based on load
  • Support for async tasks
  • Tasks return a handle which can be joined or awaited for the return value
  • Optional common process-wide thread pool

Async support

Threadfin supports asynchronous usage via futures, and allows you to mix and match both synchronous and asynchronous tasks within a single thread pool.

Examples

// Create a new pool.
let pool = threadfin::builder().size(8).build();

// Schedule some work.
let compute_task = pool.execute(|| {
    // Some expensive computation
    2 + 2
});

// Do something in the meantime.
println!("Waiting for result...");

// Wait for the task to complete and get the result.
let sum = compute_task.join();
println!("Sum: 2 + 2 = {}", sum);

Installation

Install via Cargo by adding to your Cargo.toml file:

[dependencies]
threadfin = "0.1"

Minimum supported Rust version

The minimum supported Rust version (or MSRV) for Threadfin is stable Rust 1.46 or greater, meaning we only guarantee that Threadfin will compile if you use a rustc version of at least 1.46. It might compile with older versions but that could change at any time.

This version is explicitly tested in CI and may only be bumped in new minor versions. Any changes to the supported minimum version will be called out in the release notes.

Other libraries

Sponsors

Special thanks to sponsors of my open-source work!

da-moon

License

Licensed under the MIT license. See the LICENSE file for details.

threadfin's People

Contributors

dependabot[bot] avatar sagebind avatar

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.