Minimal pthread mutex example

#include <pthread.h>
int main() {
    // Create mutex
    pthread_mutex_t mutex;
    pthread_mutex_init(&mutex, NULL /* default mutex attributes */);
    // Lock
    pthread_mutex_lock(&mutex);
    // Unlock
    pthread_mutex_unlock(&mutex);
    // Cleanup
    pthread_mutex_destroy(&mutex);
}

Compile like this:

gcc -o main main.c -pthread