ReactOS 0.4.15-dev-8339-g4028de8
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}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AcpiOsAcquireMutex(Handle, Time)
Definition: actypes.h:276
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AcpiOsReleaseMutex(Handle)
Definition: actypes.h:277
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
Status
Definition: gdiplustypes.h:25
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127

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}

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}
#define AcpiOsCreateMutex(OutHandle)
Definition: actypes.h:274

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}
#define AcpiOsDeleteMutex(Handle)
Definition: actypes.h:275
#define NULL
Definition: types.h:112

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}

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}

Referenced by AcpiTbDeleteNamespaceByOwner().