Subj : Re: Recursive lock? To : comp.programming.threads From : Jarek Kucypera Date : Thu May 19 2005 01:45 pm > Also, does the POSIX standard support recursive lock via > pthread_mutex_lock? AFAIR yes, you must specify it in mutex attributes > I believe recursive lock means you can call the lock multiple times > from the same thread and it won't block your thread. Your belief is right ;) > I'm not sure if it means you need to call unlock the same amount of > times you called lock. Yes, you do need to balance locks with unlocks. > and is it bad, and if so why? I don't think it is (bad). I haven't followed the discussion above, but in general case the gratest benefit is (IMO), it supports splitting your code into a number of independent blocks (routines, methods, objects, whatever) that can be smoothly reused. J.K. .