On Wed, Apr 02, 2008 at 11:22:17AM -0700, bhanu nani wrote:
> My understanding: Semaphore are the tools to protect a region of code
> by bloking access to other threads access while the first thead is
> accessing it.

You shouldn't protect a region of code. Semaphores (and other locking
primitives) should be used to protect *data*, not to protect *code*.
It's not bad if two threads execute the same *code* at the same time,
as long as they don't access the same *data* at the same time.


Erik

-- 
Erik Mouw -- [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to