Make sure we don't close virtual term FDs too early.
Avoid a double-delete of threads from a process.
Avoid a deadlock when exiting.

When clearing the message queue, we send a notification to the main
thread, but if the main thread was not waiting on the condition variable
at that time, the notification is lost. The main thread re-enters the
wait and gets stuck there.
Join the redirector thread before exiting.

If a non-detached std::thread is destroyed before being joined, it is
terminated with std::terminate.
Add unistd header for id types

Required for FreeBSD.
Add explicit cast to malloc return

Required to build on FreeBSD
Fix windows build with unistd.h in Types.h.
Add register description generator in Tools/.
Use %lex-param instead of #define YYLEX_PARAM.

YYLEX_PARAM has been deprecated in version 1.875 and is not supported
anymore, we have to use %lex-param instead.
Mention the libjson license in README.md.
Integrate the build of regsgen2 in the main CmakeLists.txt.

We can now do `make regsgen2` and build this tool.