locks in pthread code example
Example: how to mutex lock in c
pthread_mutex_t my_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&my_mutex);
/* locked code */
pthread_mutex_unlock(&my_mutex);
pthread_mutex_t my_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&my_mutex);
/* locked code */
pthread_mutex_unlock(&my_mutex);