Equivalent of pthread_mutex_lock and pthread_cond_wait in the linux kernel
c, linux-kernel, pthreads
Solution
- For the mutex (as Als said ):
`mutex_lock()` and `mutex_unlock()` and we should init the mutex before we use it with `mutex_init()` (from `#include <linux/mutex.h>`)
- For the equivalent of `pthread_cond_wait`
`wait_event_interruptible()` and `wake_up_interruptible()` and we should init the wait_queue_head with `init_waitqueue_head()` (from `#include <linux/wait.h>`)
Problem
What is the equivalent of `pthread_mutex_lock` and `pthread_cond_wait` in the linux kernel. and how to use them. Could you please provide simple (hello world) examples.