3 ms·
By acquiring and releasing resources. I’m not intimately familiar with Rust, so I’ll use Go as an example. Create a one-buffered channel: `make(chan T, 1)`. To
by barsonme 5y ago
By acquiring and releasing resources. I’m not intimately familiar with Rust, so I’ll use Go as an example.
Create a one-buffered channel: `make(chan T, 1)`. To acquire, receive from the channel. If the object is in use, the receive will block (goroutine put to sleep) until it’s available. To release, send the acquired object to the channel.
On a language level, no mutexes.