MCPcopy Index your code
hub / github.com/Kimundi/scoped-threadpool-rs

github.com/Kimundi/scoped-threadpool-rs @v0.1.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.7 ↗ · + Follow
35 symbols 84 edges 1 files 7 documented · 20% updated 2y ago★ 1384 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

scoped-threadpool-rs

Travis-CI Status

A library for scoped and cached threadpools.

For more details, see the docs.

Getting Started

scoped-threadpool-rs is available on crates.io. Add the following dependency to your Cargo manifest to get the latest version of the 0.1 branch:

[dependencies]

scoped_threadpool = "0.1.*"

To always get the latest version, add this git repository to your Cargo manifest:

[dependencies.scoped_threadpool]
git = "https://github.com/Kimundi/scoped-threadpool-rs"

Example

extern crate scoped_threadpool;
use scoped_threadpool::Pool;

fn main() {
    // Create a threadpool holding 4 threads
    let mut pool = Pool::new(4);

    let mut vec = vec![0, 1, 2, 3, 4, 5, 6, 7];

    // Use the threads as scoped threads that can
    // reference anything outside this closure
    pool.scoped(|scoped| {
        // Create references to each element in the vector ...
        for e in &mut vec {
            // ... and add 1 to it in a seperate thread
            // (execute() is safe to call in nightly)
            unsafe {
                scoped.execute(move || {
                    *e += 1;
                });
            }
        }
    });

    assert_eq!(vec, vec![1, 2, 3, 4, 5, 6, 7, 8]);
}

Extension points exported contracts — how you extend this code

FnBox (Interface)
(no doc) [1 implementers]
src/lib.rs

Core symbols most depended-on inside this repo

execute
called by 10
src/lib.rs
scoped
called by 8
src/lib.rs
threads_chunked_n
called by 6
src/lib.rs
sleep_ms
called by 4
src/lib.rs
threads_interleaved_n
called by 4
src/lib.rs
join_all
called by 2
src/lib.rs
call_box
called by 1
src/lib.rs
thread_count
called by 1
src/lib.rs

Shape

Function 21
Method 8
Class 4
Enum 1
Interface 1

Languages

Rust100%

Modules by API surface

src/lib.rs35 symbols

For agents

$ claude mcp add scoped-threadpool-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact