Lindenii Project Forge
Add Makefile, ev/README
docs
.POSIX: .SUFFIXES: HARE=hare HAREFLAGS= HAREDOC=haredoc DESTDIR= PREFIX=/usr/local SRCDIR=$(PREFIX)/src HARESRCDIR=$(SRCDIR)/hare THIRDPARTYDIR=$(HARESRCDIR)/third-party all: check: $(HARE) test docs: mkdir -p docs/ev $(HAREDOC) -Fhtml ev > docs/ev/index.html clean: rm -rf docs install: mkdir -p $(DESTDIR)$(THIRDPARTYDIR)/ev/+linux install -m644 ev/+linux/*.ha $(DESTDIR)$(THIRDPARTYDIR)/ev/+linux uninstall: rm -rf $(DESTDIR)$(THIRDPARTYDIR)/ev .PHONY: all docs clean check install uninstall
ev provides an event loop for asynchronous I/O. Start with [[newloop]] to create an event loop, then register files with it using [[register]], or convenience functions like [[listen_tcp]]. Async operations are provided such as [[read]], [[write]], and [[accept]]; each of these schedules an I/O operation to be performed once the operating system is ready to accept it without blocking. Users provide a callback to scheduling functions which is called with the result of the I/O operation once completed. Call [[ev::dispatch]] to process events for your event loop. This function will return true until you call [[ev::stop]], providing a convenient means of exiting the event loop from within callbacks. Thus, your core event loop might look like this: for (ev::dispatch(&loop, -1)) void;