FIND YOUR NEXT FEW LINES

Results for “thread”

Small, practical examples. Search by task or narrow things down below.

114 snippets foundClear filters
RustThreads & shared ownership

Borrow local data in a scoped thread

Borrow local data in a scoped thread in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Join a worker thread and read its result

Join a worker thread and read its result in a complete Rust program using the standard library.

Rust✓ Tested
C++Tasks & synchronization

Pass an argument into a worker thread

C++: Thread arguments are copied by default; std::ref explicitly passes a reference.

C++✓ Tested
C++Tasks & synchronization

Run a task on a thread and join it

C++: Join before reading a result written by the worker thread.

C++✓ Tested
RustThreads & shared ownership

Initialize shared data once

Initialize shared data once in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Move owned data into a worker

Move owned data into a worker in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Protect shared mutable state with a mutex

Protect shared mutable state with a mutex in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Read a channel until all senders close

Read a channel until all senders close in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Send a value through a channel

Send a value through a channel in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Share immutable data with Arc

Share immutable data with Arc in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Update an atomic counter

Update an atomic counter in a complete Rust program using the standard library.

Rust✓ Tested
C++Containers & compound values

Add and remove values at both ends

C++: Deque supports efficient end operations without requiring contiguous storage.

C++✓ Tested