# Test & Set

DevFeed: [Test & Set](<https://devfeed.tech/articles/test-set-32253.md>)

Original publisher: [Read original article](<https://publicobject.com/2026/07/13/test-set/>)

Author: Jesse Wilson

Published: 2026-07-13T22:22:27Z

Content type: tutorial

Language: en

Sources: [Public Object](<https://devfeed.tech/sources/public-object.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Code](<https://devfeed.tech/topics/code.md>), [function](<https://devfeed.tech/topics/function.md>), [business logic](<https://devfeed.tech/topics/business-logic.md>)

Tags: [business-logic](<https://devfeed.tech/tags/business-logic.md>), [code](<https://devfeed.tech/tags/code.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [flaky-tests](<https://devfeed.tech/tags/flaky-tests.md>), [function](<https://devfeed.tech/tags/function.md>), [programming](<https://devfeed.tech/tags/programming.md>), [tests](<https://devfeed.tech/tags/tests.md>), [threads](<https://devfeed.tech/tags/threads.md>)

## AI overview

An article about managing concurrency in threaded programs. It discusses the limits of simple and stress tests, describes a trusted concurrency pattern, and presents a helper function that separates business logic from concurrency logic while retrying after a lost race.

## Source excerpt

Working with threads always feels hazardous to me. Non-determinism limits how much we can exercise with simple tests. Stress tests can shake out some bugs, but they're slow and potentially flaky. I don't like flaky tests. So I have a few concurrency patterns that I trust, and I