basic pthread functionality.  TODO: implement abstract Thread class that would be smart enough to define it with PTHREADS.