Using Swift Actors to Protect Shared State in Asynchronous Code
Learn how Swift actors eliminate data races by isolating mutable state, see a concrete counter example, and understand the reentrancy trade‑off.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how Swift actors eliminate data races by isolating mutable state, see a concrete counter example, and understand the reentrancy trade‑off.
Learn how to implement a thread-safe Singleton in C# using Lazy<T> to avoid race conditions and manual locking during shared resource initialization.
Learn how to build a thread‑safe singleton in Objective‑C with GCD’s dispatch_once, including verification steps and failure‑mode analysis.
The goal is to decide whether a markdown parser should be shared across concurrent HTTP requests or instantiated per request when integrating a markdown renderer with a web server. Sharing a single parser instance can reduce memory overhead but may introduce lock contention if the parser maintains mutable state such as extension registers or internal caches.
COBOL programs declare static data items in the WORKING-STORAGE SECTION that are shared across all invocations. In multi-threaded execution, the runtime implicitly serializes access to these items, introducing latency that only becomes apparent under concurrent request loads. This behavior varies across compilers; some require a THREAD option for reentrancy,
Developers need a way to run tf.keras.Model.predict concurrently from multiple threads without wrapping each call in an external lock, while keeping latency predictable under load. The current documentation notes that predict is not thread‑safe and recommends manual locking or duplicate models, but it does not specify whether a built‑in thread‑safe mode coul
Goal To determine how SQLite’s interrupt and busy‑timeout mechanisms cooperate when a statement is blocked on a write-ahead‑logging (WAL) lock, and whether an interrupt can reliably abort such a query. Constraints & Uncertainty The SQLite API specifies that sqlite3_interrupt sends a cancellation request to the thread executing the current statement, and
I'm auditing a set of older C++ plug-in nodes (compiled against pre-2016 Maya APIs) that are now loaded in a modern Maya version where the Evaluation Manager runs in parallel mode by default. These nodes predate MPxNode::evaluationMethod() , so they cannot declare kSerial or kDefer — as I understand it, they silently fall back to kParallel . Some of these no
Goal: enable conversion of a POSIX timestamp to a broken‑down time in an arbitrary time zone without mutating the process TZ variable, while remaining safe for concurrent calls. Constraint: Unix.localtime and Unix.gmtime rely on the C library’s tzdata and modify a shared static struct, making them unsafe in multi‑threaded code; the standard library offers no