From 72de94e9c80f1a2d03bc184a5731805c390143f5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 16 Dec 2022 10:43:35 +0100 Subject: [PATCH] Add Makefile, ev/README --- .gitignore | 1 + Makefile | 32 ++++++++++++++++++++++++++++++++ ev/README | 15 +++++++++++++++ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d8f8d46921aa81abc4c0d27703a8908333ae38c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +docs diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..1dd14f27f8d6dcff7325d5453bf87428bc56961e --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +.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 diff --git a/ev/README b/ev/README new file mode 100644 index 0000000000000000000000000000000000000000..aa33d9a7b556419e93efb8a000eeed5e3747e4e8 --- /dev/null +++ b/ev/README @@ -0,0 +1,15 @@ +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; -- 2.48.1