Thread signal handling

Forevery SIGTERM or SIGHUP signaled, the thread is sent a SIGALRM to
wake up usleeped thread, So there is not a delay at the end of a kill
Recursive loop

Check the signal type is different to SIGALRM before signaling threads
otherwise the signalling will recursively never end
Removed Magic numbers and locked globals

EXIT and RELOAD now use proper locks, And added macro definition for
server ticks and buffer size