Is Channel::send thread-safe?

#1

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?

#2

Yes, the whole interface is thread safe.

1 Like