ReactOS  0.4.14-dev-1112-g2b067d6
utlock.c File Reference
#include "acpi.h"
#include "accommon.h"
Include dependency graph for utlock.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_UTILITIES
 

Functions

ACPI_STATUS AcpiUtCreateRwLock (ACPI_RW_LOCK *Lock)
 
void AcpiUtDeleteRwLock (ACPI_RW_LOCK *Lock)
 
ACPI_STATUS AcpiUtAcquireReadLock (ACPI_RW_LOCK *Lock)
 
ACPI_STATUS AcpiUtReleaseReadLock (ACPI_RW_LOCK *Lock)
 
ACPI_STATUS AcpiUtAcquireWriteLock (ACPI_RW_LOCK *Lock)
 
void AcpiUtReleaseWriteLock (ACPI_RW_LOCK *Lock)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 48 of file utlock.c.

Function Documentation

◆ AcpiUtAcquireReadLock()

ACPI_STATUS AcpiUtAcquireReadLock ( ACPI_RW_LOCK Lock)

Definition at line 117 of file utlock.c.

119 {
121 
122 
124  if (ACPI_FAILURE (Status))
125  {
126  return (Status);
127  }
128 
129  /* Acquire the write lock only for the first reader */
130 
131  Lock->NumReaders++;
132  if (Lock->NumReaders == 1)
133  {
135  }
136 
137  AcpiOsReleaseMutex (Lock->ReaderMutex);
138  return (Status);
139 }
ACPI_STATUS AcpiOsAcquireMutex(ACPI_MUTEX Handle, UINT16 Timeout)
Definition: osl.c:306
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
Status
Definition: gdiplustypes.h:24
void AcpiOsReleaseMutex(ACPI_MUTEX Handle)
Definition: osl.c:333

Referenced by AcpiWalkNamespace().

◆ AcpiUtAcquireWriteLock()

ACPI_STATUS AcpiUtAcquireWriteLock ( ACPI_RW_LOCK Lock)

Definition at line 185 of file utlock.c.

187 {
189 
190 
192  return (Status);
193 }
ACPI_STATUS AcpiOsAcquireMutex(ACPI_MUTEX Handle, UINT16 Timeout)
Definition: osl.c:306
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
Status
Definition: gdiplustypes.h:24

Referenced by AcpiTbDeleteNamespaceByOwner().

◆ AcpiUtCreateRwLock()

ACPI_STATUS AcpiUtCreateRwLock ( ACPI_RW_LOCK Lock)

Definition at line 66 of file utlock.c.

68 {
70 
71 
72  Lock->NumReaders = 0;
73  Status = AcpiOsCreateMutex (&Lock->ReaderMutex);
74  if (ACPI_FAILURE (Status))
75  {
76  return (Status);
77  }
78 
79  Status = AcpiOsCreateMutex (&Lock->WriterMutex);
80  return (Status);
81 }
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiOsCreateMutex(ACPI_MUTEX *OutHandle)
Definition: osl.c:271

Referenced by AcpiUtMutexInitialize().

◆ AcpiUtDeleteRwLock()

void AcpiUtDeleteRwLock ( ACPI_RW_LOCK Lock)

Definition at line 85 of file utlock.c.

87 {
88 
89  AcpiOsDeleteMutex (Lock->ReaderMutex);
90  AcpiOsDeleteMutex (Lock->WriterMutex);
91 
92  Lock->NumReaders = 0;
93  Lock->ReaderMutex = NULL;
94  Lock->WriterMutex = NULL;
95 }
smooth NULL
Definition: ftsmooth.c:416
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
void AcpiOsDeleteMutex(ACPI_MUTEX Handle)
Definition: osl.c:293

Referenced by AcpiUtMutexTerminate().

◆ AcpiUtReleaseReadLock()

ACPI_STATUS AcpiUtReleaseReadLock ( ACPI_RW_LOCK Lock)

Definition at line 143 of file utlock.c.

145 {
147 
148 
150  if (ACPI_FAILURE (Status))
151  {
152  return (Status);
153  }
154 
155  /* Release the write lock only for the very last reader */
156 
157  Lock->NumReaders--;
158  if (Lock->NumReaders == 0)
159  {
160  AcpiOsReleaseMutex (Lock->WriterMutex);
161  }
162 
163  AcpiOsReleaseMutex (Lock->ReaderMutex);
164  return (Status);
165 }
ACPI_STATUS AcpiOsAcquireMutex(ACPI_MUTEX Handle, UINT16 Timeout)
Definition: osl.c:306
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
Status
Definition: gdiplustypes.h:24
void AcpiOsReleaseMutex(ACPI_MUTEX Handle)
Definition: osl.c:333

Referenced by AcpiWalkNamespace().

◆ AcpiUtReleaseWriteLock()

void AcpiUtReleaseWriteLock ( ACPI_RW_LOCK Lock)

Definition at line 197 of file utlock.c.

199 {
200 
201  AcpiOsReleaseMutex (Lock->WriterMutex);
202 }
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
void AcpiOsReleaseMutex(ACPI_MUTEX Handle)
Definition: osl.c:333

Referenced by AcpiTbDeleteNamespaceByOwner().