This commit adds the threads library

Various parts of pilight rely on threads to be able to run
simultaneously. However, it's not always (easily) possible to start a
thread and also keeping the function that started the thread alive.
Failing to do so will stop the thread. So instead of creating a
confusing circle of threads that start threads of their own, pilight
now incoporates a specific threading library. Every part of the
program can now register a thread and one main loop will take care
of starting and stopping these threads.