Lindenii Project Forge
Login

hare-ev

Temporary fork of hare-ev for... reasons
Commit info
ID
72de94e9c80f1a2d03bc184a5731805c390143f5
Author
Drew DeVault <sir@cmpwn.com>
Author date
Fri, 16 Dec 2022 10:43:35 +0100
Committer
Drew DeVault <sir@cmpwn.com>
Committer date
Fri, 16 Dec 2022 10:43:35 +0100
Actions
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;