A simple cooperative multitasking event framework written in C++.
C++ Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
Makefile
README.md
acceptor.cc
acceptor.h
connector.cc
connector.h
context.cc
context.h
core.cc
core.h
counter.cc
counter.h
demangler.cc
demangler.h
duration.cc
duration.h
file_descriptor.cc
file_descriptor.h
inet6_address.cc
inet6_address.h
inet_address.cc
inet_address.h
killable.cc
killable.h
killer.cc
killer.h
local_address.cc
local_address.h
open_fds.cc
reactor.cc
reactor.h
resource_limit.h
rfc862c.cc
rfc862d.cc
scheduler.cc
scheduler.h
semaphore.cc
semaphore.h
signal_killer.cc
signal_killer.h
signal_set.cc
signal_set.h
signal_stack.cc
signal_stack.h
signal_suppressor.cc
signal_suppressor.h
signaler.cc
signaler.h
simple_task.cc
simple_task.h
socket_address.cc
socket_address.h
stack.cc
stack.h
task.cc
task.h
test_semaphore.cc
test_timers.cc
timer.cc
timer.h
trigger.cc
trigger.h

README.md

liboco

liboco is a simple cooperative multitasking event framework written in C++ as an exercise for the author. It is not meant as a replacement for libpthread, libevent, libev, &c.

Requires

Based around ucontext and epoll, it is not currently intended to be portable. In fact, it uses glibc extensions and Linux-specific system calls, so it will probably only compile with that standard library and run on a very modern kernel.

It is also not very safe regarding signals that are not processed via signalfd. In particular, calling core::schedule or core::wait_for_* with any pending signals that were not blocked when core::react was invoked are likely to be handled at that time. Signal masks should not be modified from within tasks.

It comes with the following example programs.

  • rfc862d --- Echo server, bound to any IPv4 address on port 7.
  • rfc862c --- Echo client, connects to 127.0.0.1 on port 7.

and

  • open_fds --- Lists open FDs. When launched as a child, useful for finding FD leaks in parent process.

While liboco is just a toy, the intention is to continue to add features and hammer out some more interesting use-cases.