https://kotlinlang.org logo
#coroutines
Title
# coroutines
u

ursus

01/26/2021, 5:56 AM
This might be slightly offtopic, but how do you unit test concurrent code? If I just let loose two threads at a function, im not guaranteed contention will happen, right?
z

Zach Klippenstein (he/him) [MOD]

01/26/2021, 7:24 PM
Take a look at the stress tests in the coroutines repo. Typically involves iterating a lot to try to increase the chance of contention happening.
👍 1
u

ursus

01/26/2021, 11:13 PM
Thanks! But just to clarify, its just a best effort, right? i.e. its impossible to do 100% sure?
z

Zach Klippenstein (he/him) [MOD]

01/26/2021, 11:40 PM
AFAIK, yes