Skip to content

Instantly share code, notes, and snippets.

View kkonevets's full-sized avatar
🏠
Working from home

int80hx kkonevets

🏠
Working from home
  • World
  • 06:21 (UTC +03:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kkonevets on github.
  • I am kkonevets (https://keybase.io/kkonevets) on keybase.
  • I have a public key ASBDwhEUid3Y8x8VN7AqS-CuaY_TF0XXddWhC5SUbXx2sAo

To claim this, I am signing this object:

use std::error::Error;
use std::sync::mpsc;
use std::sync::Arc;
use std::thread;
const NTHREADS: usize = 4;
/// Apply function `f` to vector `v` in parallelm keeping the order.
/// If `v` length is less than `threshold` no splitting will occur and no threads be created
fn apply_par<F, T, R>(v: Vec<T>, f: F, threshold: usize) -> Result<Vec<R>, Box<dyn Error>>