Added checks for failure of malloc and thread calls.
Updated makefile to compile .c files and rm the correct binaries
when clean is used.
Added COND_CHECK macro to check a condition and exit if it fails.