Multithreaded linked list functions in C