Draft: Introduce and use emper::exit

Open Florian Fischer requested to merge aj46ezos/emper:emper_exit into master

Calling exit(3) from within the runtime is racy because some worker
threads could hold references to resources which are freed by the thread
calling exit(3).

To solve this problem the new functions emper::exit(int) and emper_exit(int)
are introduced which initiate the termination of the runtime and exit
the current worker thread.

We have to ensure that no worker thread is using resources that are owned and
freed by other threads. This is done with a Latch that the workers use to synchronize before actually terminating.

The exit status specified by the worker thread is propagated to the
thread calling Runtime::waitUntilFinished which will call exit(3) with
the worker provided status.

Fixes #14 (closed).

Edited by Florian Fischer

Merge request reports