Some random unix related fixes as well as starting to refactor realtime threads to a common class (checklogfile real time stuff "might" not work currently, willbe fixed in the next day or so)