I am writing a OS abstraction library for which i want to write wrappers for pthread mutex over Linux.
This code shall be called by multiple threads.
The code goes something like this:
int my_lock(pthread_mutex_t *mutex)
{
return pthread_mutex_lock(mutex);
}
- Will the function my_lock also will be thread-safe?
- If not, How to make it thread-safe?
This is what you posted as your function:
Why do you even need the function here?
The code is thread-safe as you have presented it.