Using pthread_mutex_lock

On Windows there is a function called EnterCriticalSection. It will not block if the same thread calls it more than once. I want to do the same thing on Linux and was trying pthread_mutex_lock. But that does not check to see if it is the same thread and will still block if the same thread calls it twice (a deadlock).

Is there a pthread_mutex that will do the same thing as EnterCriticalSection?
It looks like trylock should work. Thanks.
No, you need a recursive lock.
sa? O.o (the post I was asking about the "sa?" from, was remoed)
Last edited on
Recursive lock. Yea, I noticed that and should have gotten back to you.
Topic archived. No new replies allowed.