threads.c/h now provides an abstracted semaphore type ('lock_t'). This is also used internally by threads.c to allow the easiest possible 'porting' of the thread-related stuff.
Added 'lock' around the hash table. Fixes bug caused by trying to resize the hash table during a search (also occured when trying to clear it).
Added newline to error output.