News for hackers. Stuff that matters.
Re:Show HN: Go channels as a C library (with Obj-C wrapper) by davekeck on Wednesday October 01, 2014 @12:29PM (#8395704)
eb_chan is a C library (supporting OS X, iOS, and Linux) that provides a complete implementation of the Go channel primitive. Also included is an Objective-C wrapper which allows for a convenient select-statement syntax using blocks.

eb_chan provides the full range of functionality of Go channels, including blocking and non-blocking selects on an arbitrary number of sends and receives.

Two focuses of this project are to maximize throughput and minimize resource consumption. To maximize throughput, eb_chan includes a fast-path (to avoid making system calls) which consists merely of acquiring a spinlock and modifying a structure. To minimize resource consumption, eb_chan avoids using scarce resources, such as file-descriptor-based primitives like UNIX pipes. Instead, eb_chan uses Mach semaphores (semaphore_t) on Darwin, and POSIX semaphores (sem_t) on Linux, both of which can be allocated on the order of 10^5 without hitting resource limits.

Feedback appreciated!

There are no comments on this comment yet.