5 ms·
You'd pass pointers to the buffers over the channels, so there wouldn't be much copying. You would need to be careful that once one goroutine has sent a pointe
by twic 7y ago
You'd pass pointers to the buffers over the channels, so there wouldn't be much copying.
You would need to be careful that once one goroutine has sent a pointer to a channel, it doesn't touch that buffer again (until the receiver has finished with it, at least), otherwise you can get data races. You're implementing ownership semantics here, and unlike in some languages i could name, you're doing it without help from the type system.
- zamadatix 7y agoAt that point just use a mutex.