Re: [PATCH 1/12]: MUTEX: Implement mutexes

From: Steven Rostedt
Date: Fri Dec 16 2005 - 22:58:24 EST


On Fri, 2005-12-16 at 23:13 +0000, David Howells wrote:
> The attached patch introduces a simple mutex implementation as an alternative
> to the usual semaphore implementation where simple mutex functionality is all
> that is required.
>
> This is useful in two ways:
>
> (1) A number of archs only provide very simple atomic instructions (such as
> XCHG on i386, TAS on M68K, SWAP on FRV) which aren't sufficient to
> implement full semaphore support directly. Instead spinlocks must be
> employed to implement fuller functionality.
>
> (2) This makes it more obvious that a mutex is a mutex and restricts the
> capabilites to make it more easier to debug.
>
> This patch set does the following:
>
> (1) Renames DECLARE_MUTEX and DECLARE_MUTEX_LOCKED to be DECLARE_SEM_MUTEX and
> DECLARE_SEM_MUTEX_LOCKED for counting semaphores.
>

Could we really get rid of that "MUTEX" part. A counting semaphore is
_not_ a mutex, although a mutex _is_ a counting semaphore. As is a Jack
Russell is a dog, but a dog is not a Jack Russell.

What's the reason not to just use DECLARE_SEM and DECLARE_SEM_LOCKED?

-- Steve


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/