ConcurrentProgrammingWithGo
ConcurrentProgrammingWithGo copied to clipboard
Listings from manning book
> In previous chapters, we saw the TryLock() operation on mutexes. This is a nonblocking call that returns immediately without waiting. If the lock is not available, the function returns...
in [listing 9_11](https://github.com/cutajarj/ConcurrentProgrammingWithGo/blob/b3d5bcf683a946ac9ef15d34a0545c2a843e0593/chapter9/listing9.9_11/extractwordsmulti.go#L34) : downloadPages was sending all response bodies back to first channel of Pages slice , so i just removed the loop so per call downloadPages sends back...
Hello! Thanks for a great book, enjoying it so far. I have a question about weighted semaphore exercise. Why do we use Signal here instead of Broadcast? Suppose goroutine g1...
I guess a more correct impl would be: ```go func (c *Channel[M]) Receive() M { c.sizeSema.Acquire() c.mutex.Lock() v := c.buffer.Remove(c.buffer.Front()).(M) c.mutex.Unlock() c.capacitySema.Release() return v } ``` In the original implementation,...
> Change listing 10.2 so that the work queue channel between the main() goroutine and the worker pool has a buffer of 10 messages. Doing so will give you a...