1 /* $Id: fmutex.c,v 1.6 2000/06/09 20:02:59 ekohl Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/ex/fmutex.c
6 * PURPOSE: Implements fast mutexes
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
16 #include <internal/debug.h>
19 /* FUNCTIONS *****************************************************************/
24 ExAcquireFastMutexUnsafe (
28 if (InterlockedDecrement(&(FastMutex
->Count
))==0)
32 FastMutex
->Contention
++;
33 KeWaitForSingleObject(&(FastMutex
->Event
),
38 FastMutex
->Owner
=KeGetCurrentThread();
44 ExReleaseFastMutexUnsafe (
48 assert(FastMutex
->Owner
== KeGetCurrentThread());
49 FastMutex
->Owner
=NULL
;
50 if (InterlockedIncrement(&(FastMutex
->Count
))<=0)
54 KeSetEvent(&(FastMutex
->Event
),0,FALSE
);