Daqd not exiting issue 96
Issue #96 (closed) deals with a daqd process that hangs on exit. Upon investigation it appears that code is getting stuck in the destructors.
This reworks the thread handling so that threads are created against an ad-hoc system that ensures they are always joined and closed down. The initial target of this code is the trender object. All trender created threads are now managed via a thread_handler_t object.
In addition some wrappers of pthread functionality are introduced to reduce the boilerplate and to use RAII to remove the need to manually call pthread attribute cleanup functions on each exit path.
A requirement of the thread code is that the thread handler be given an application supplied stop thread that upon calling will stop (eventually) each of the threads that have been launched. Thus some of the circular buffer code has been modified to allow a timed wait so that stop flags could be checked.