C#C
C#14mo ago
Stage

Possible race condition?

Maybe I'm just totally off but...

I'm not sure whether _credentials is implemented safely.

I've been reading a lot on how async works under the hood (specifically the task scheduler) and I don't know whether this variable would be susceptible to a race condition if AuthorizeUserWithCodeAsync is called in rapid succession (see this endpoint which will be calling it). My fear is that if this endpoint is called in rapid succession, _credentials could be accessed or overwritten in an unintended way. Is this just a lock and move on situation or is this actually safe?
Was this page helpful?