Is Channel::send thread-safe?


The documentation of send method for Channel says:

Cancellation of suspended send is atomic

But is the addition of a new element to the Channel atomic itself? I mean if two coroutines try to send at the same time, can that produce a race condition?


Yes, the whole interface is thread safe.

1 Like