+FSCTL_DISMOUNT_VOLUME define
[reactos.git] / hal / halx86 / fmutex.c
1 /* $Id$
2  *
3  * COPYRIGHT:       See COPYING in the top level directory
4  * PROJECT:         ReactOS kernel
5  * FILE:            ntoskrnl/hal/x86/fmutex.c
6  * PURPOSE:         Implements fast mutexes
7  * PROGRAMMER:      David Welch (welch@cwcom.net)
8  *                  Eric Kohl (ekohl@rz-online.de)
9  * UPDATE HISTORY:
10  *                  Created 09/06/2000
11  */
12
13 /* INCLUDES *****************************************************************/
14
15 #include <ddk/ntddk.h>
16
17 #include <internal/debug.h>
18
19 /* FUNCTIONS *****************************************************************/
20
21 VOID FASTCALL
22 ExAcquireFastMutex (PFAST_MUTEX FastMutex)
23 {
24    KeEnterCriticalRegion();
25    ExAcquireFastMutexUnsafe(FastMutex);
26 }
27
28
29 VOID FASTCALL
30 ExReleaseFastMutex (PFAST_MUTEX FastMutex)
31 {
32   ExReleaseFastMutexUnsafe(FastMutex);
33   KeLeaveCriticalRegion();
34 }
35
36
37 BOOLEAN FASTCALL
38 ExTryToAcquireFastMutex (PFAST_MUTEX FastMutex)
39 {
40   KeEnterCriticalRegion();
41   if (InterlockedExchange(&FastMutex->Count, 0) == 1)
42     {
43       FastMutex->Owner = KeGetCurrentThread();
44       return(TRUE);
45     }
46   else
47     {
48       KeLeaveCriticalRegion();
49       return(FALSE);
50     }
51 }
52
53 /* EOF */