2 ms·
> However it will most likely not work out with pipes as I don't know how you could implement the synchronous (unbuffered) channels with them. Easy. Just imple
by pcwalton 10y ago
> However it will most likely not work out with pipes as I don't know how you could implement the synchronous (unbuffered) channels with them.
Easy. Just implement them with a mutex and a condvar. If you want, layer some lock free algorithm on top for the fast path.
- chubot 10y agoYeah actually the Lua implementation I mentioned uses a condition variable (not sure about the mutex). The unbuffered channel would be a good reason to use that scheme. I was thinking of using pipes so Go's select reduces to the select() system call. But I think you can just do both -- it's cheap. Write to a pipe and and notify a condition variable. I'll experiment with it.