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.
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!