ntoskrnl.exe: Implement ExReleaseResourceForThreadLite().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b13a00f82b
commit
9dfa9f6b26
|
@ -3364,14 +3364,6 @@ NTSTATUS WINAPI ExDeleteResourceLite(PERESOURCE resource)
|
|||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExReleaseResourceForThreadLite (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
void WINAPI ExReleaseResourceForThreadLite( PERESOURCE resource, ERESOURCE_THREAD tid )
|
||||
{
|
||||
FIXME( "stub: %p %lu\n", resource, tid );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* KeEnterCriticalRegion (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
|
|
|
@ -1006,3 +1006,63 @@ BOOLEAN WINAPI ExAcquireSharedWaitForExclusive( ERESOURCE *resource, BOOLEAN wai
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExReleaseResourceForThreadLite (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
void WINAPI ExReleaseResourceForThreadLite( ERESOURCE *resource, ERESOURCE_THREAD thread )
|
||||
{
|
||||
OWNER_ENTRY *entry;
|
||||
KIRQL irql;
|
||||
|
||||
TRACE("resource %p, thread %#lx.\n", resource, thread);
|
||||
|
||||
KeAcquireSpinLock( &resource->SpinLock, &irql );
|
||||
|
||||
if (resource->Flag & ResourceOwnedExclusive)
|
||||
{
|
||||
if (resource->OwnerEntry.OwnerThread == thread)
|
||||
{
|
||||
if (!--resource->ActiveEntries)
|
||||
{
|
||||
resource->OwnerEntry.OwnerThread = 0;
|
||||
resource->Flag &= ~ResourceOwnedExclusive;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Trying to release %p for thread %#lx, but resource is exclusively owned by %#lx.\n",
|
||||
resource, thread, resource->OwnerEntry.OwnerThread);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = resource_get_shared_entry( resource, thread );
|
||||
if (entry->OwnerCount)
|
||||
{
|
||||
entry->OwnerCount--;
|
||||
resource->ActiveEntries--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Trying to release %p for thread %#lx, but resource is not owned by that thread.\n", resource, thread);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!resource->ActiveEntries)
|
||||
{
|
||||
if (resource->NumberOfExclusiveWaiters)
|
||||
{
|
||||
KeSetEvent( resource->ExclusiveWaiters, IO_NO_INCREMENT, FALSE );
|
||||
}
|
||||
else if (resource->NumberOfSharedWaiters)
|
||||
{
|
||||
KeReleaseSemaphore( resource->SharedWaiters, IO_NO_INCREMENT,
|
||||
resource->NumberOfSharedWaiters, FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
KeReleaseSpinLock( &resource->SpinLock, irql );
|
||||
}
|
||||
|
|
|
@ -1529,6 +1529,7 @@ PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK);
|
|||
PSLIST_ENTRY WINAPI ExInterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY,PKSPIN_LOCK);
|
||||
LIST_ENTRY * WINAPI ExInterlockedRemoveHeadList(LIST_ENTRY*,KSPIN_LOCK*);
|
||||
void WINAPI ExReleaseFastMutexUnsafe(PFAST_MUTEX);
|
||||
void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD);
|
||||
ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN);
|
||||
|
||||
void WINAPI IoAcquireCancelSpinLock(KIRQL*);
|
||||
|
|
Loading…
Reference in New Issue