thread-safe routine

noun
UK /θrɛd seɪf ruːˈtiːn/
US /θrɛd seɪf ruˈtin/

A piece of computer code that many helpers can use at the same time without making mistakes.

The programmer made the thread-safe routine so two tasks could update the list without crashing.


OTHER MEANINGS

2. A function designed to be called by multiple threads without causing data corruption.

We wrapped the counter update in a thread-safe routine to avoid lost increments.

3. Code that protects shared resources using locks or atomic operations.

The thread-safe routine acquires the mutex before touching the shared buffer.

4. A procedure that can run concurrently in parallel programs without undefined behavior.

Reviewers flagged the global variable until it was moved into a thread-safe routine.