Results for “shared”
Small, practical examples. Search by task or narrow things down below.
Ignore a personal scratch file without changing shared rules
Git: The repository-local exclude file applies only to this checkout.
Git✓ Tested
Increment a shared counter atomically
C#: Interlocked performs an indivisible update without a separate lock for this operation.
C#✓ Tested
Increment a shared counter safely
C++: Atomic increments prevent lost updates when two threads change the same counter.
C++✓ Tested
Initialize shared data once
Initialize shared data once in a complete Rust program using the standard library.
Rust✓ Tested
Join two sorted files by a shared key
Linux Commands: Use join for sorted, simple delimiter-separated records with one row per key.
Linux Commands✓ Tested
Observe shared ownership without extending its lifetime
C++: A weak_ptr can be locked while an owner exists and becomes expired after the last owner is released.
C++✓ Tested
Protect a shared container with a mutex
C++: A scoped lock_guard releases the mutex when its scope ends.
C++✓ Tested
Protect a shared counter
Protect a shared counter using a complete Go program with explicit sample inputs.
Go✓ Tested
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
Update a shared counter atomically
Java: AtomicInteger provides an indivisible increment operation for a shared counter.
Java✓ Tested
Update state shared through context
Update state shared through context with a small React component and explicit browser behavior.
React✓ Tested
Wait for shared state with a condition variable
C++: Use a predicate so spurious wakeups cannot allow the worker to continue before the state is ready.
C++✓ Tested