poolter 0.1.0

Thread Pool implementation for Rust using JavaScript Promise like functional syntax
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 6.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.38 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tigranbs

PoolTer

This is a very basic Thread Pool library for Rust, mainly designed as a concurrent task running mechanism inspired from JavaScript Promise structure.

[dependencies]
poolter = "*"

Usage

Library itself is very simple and with 0 overhead, but giving a lot of benefits in terms of functional programming and splitting logic into multiple concurrent parts using limited resources.

extern crate poolter;

use poolter::PoolTer;

.......
let mut pool = PoolTer::init();

init() function will start threads based on CPU cores count and will start listening callback functions to be running for CPU cores using basic Round Rubin over available threads. This is giving advantage of splitting load over multiple cores and keep simplicity.

So now we can run functions in thread loop using basic JavaScript Promise like code syntax

// This will be executing in Thread 1
pool.exec(Box::new(move || {
  println!("This will run first in Thread 1 !");
})).then(Box::new(move || {
  println!("After that we will call this one in Thread 1 !");
}));

// This will be executing in Thread 2
pool.exec(Box::new(move || {
  println!("This will run first in Thread 2 !");
})).then(Box::new(move || {
  println!("After that we will call this one in Thread 2 !");
}));

Contributions are welcome

This is basic library, but if you find some bugs or wrong typed code logic please feel free to make a pull request or open an issue.