deadlock code snippets in C