Linux compile fixes. Better attempts at cross platform code.
Linux platform compile fixes.
Adding linux pthread code.
Adding semaphore and conditional variable for linux.