Author: hbelusca
Date: Sat Oct 5 20:06:47 2013
New Revision: 60541
URL:
http://svn.reactos.org/svn/reactos?rev=60541&view=rev
Log:
[CSRSRV]
- Do not associate the newly created wait block to the waiting thread (in
CsrInitializeWait) in case this one is going to terminate, but do it instead in
CsrCreateWait, where the check actually takes place.
- Avoid PPORT_MESSAGE casts.
- Fix a list insertion problem in CsrMoveSatisfiedWait.
- Fix some descriptions / comments.
Modified:
trunk/reactos/include/reactos/subsys/csr/csrsrv.h
trunk/reactos/subsystems/win32/csrsrv/wait.c
Modified: trunk/reactos/include/reactos/subsys/csr/csrsrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/csr…
==============================================================================
--- trunk/reactos/include/reactos/subsys/csr/csrsrv.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/csr/csrsrv.h [iso-8859-1] Sat Oct 5 20:06:47
2013
@@ -343,7 +343,7 @@
VOID
NTAPI
-CsrMoveSatisfiedWait(IN PLIST_ENTRY NewEntry,
+CsrMoveSatisfiedWait(IN PLIST_ENTRY DestinationList,
IN PLIST_ENTRY WaitList);
BOOLEAN
Modified: trunk/reactos/subsystems/win32/csrsrv/wait.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrsrv/wa…
==============================================================================
--- trunk/reactos/subsystems/win32/csrsrv/wait.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/csrsrv/wait.c [iso-8859-1] Sat Oct 5 20:06:47 2013
@@ -71,11 +71,10 @@
}
/* Initialize it */
- WaitBlock->Size = Size;
- WaitBlock->WaitThread = CsrWaitThread;
- CsrWaitThread->WaitBlock = WaitBlock;
- WaitBlock->WaitContext = WaitContext;
- WaitBlock->WaitFunction = WaitFunction;
+ WaitBlock->Size = Size;
+ WaitBlock->WaitThread = CsrWaitThread;
+ WaitBlock->WaitContext = WaitContext;
+ WaitBlock->WaitFunction = WaitFunction;
WaitBlock->WaitList.Flink = NULL;
WaitBlock->WaitList.Blink = NULL;
@@ -96,7 +95,7 @@
* CSR Wait Block, and replies to the attached CSR API Message, if any.
*
* @param WaitBlock
- * Pointer to the CSR Wait Block
+ * Pointer to the CSR Wait Block.
*
* @param WaitList
* Pointer to the wait list for this wait.
@@ -146,7 +145,7 @@
/* Reply to the port */
NtReplyPort(WaitBlock->WaitThread->Process->ClientPort,
- (PPORT_MESSAGE)&WaitBlock->WaitApiMessage);
+ &WaitBlock->WaitApiMessage.Header);
/* Check if we should dereference the thread */
if (DereferenceThread)
@@ -186,7 +185,7 @@
* The CsrCreateWait routine creates a CSR Wait.
*
* @param WaitList
- * Pointer to a list entry of the waits to associate.
+ * Pointer to a wait list in which the wait will be added.
*
* @param WaitFunction
* Pointer to the function that will handle this wait.
@@ -232,11 +231,13 @@
if (CsrWaitThread->Flags & CsrThreadTerminated)
{
/* Fail the wait */
- CsrWaitThread->WaitBlock = NULL;
RtlFreeHeap(CsrHeap, 0, WaitBlock);
CsrReleaseWaitLock();
return FALSE;
}
+
+ /* Associate the newly created wait to the waiting thread */
+ CsrWaitThread->WaitBlock = WaitBlock;
/* Insert the wait in the queue */
InsertTailList(WaitList, &WaitBlock->WaitList);
@@ -309,14 +310,15 @@
* @name CsrMoveSatisfiedWait
* @implemented NT5
*
- * The CsrMoveSatisfiedWait routine moves satisfied waits from a wait list
- * to another list entry.
- *
- * @param NewEntry
- * Pointer to a list entry where the satisfied waits will be added.
+ * The CsrMoveSatisfiedWait routine moves satisfied waits from
+ * a wait list to another list.
+ *
+ * @param DestinationList
+ * Pointer to a list in which the satisfied waits will be added.
*
* @param WaitList
- * Pointer to a list entry to analyze for satisfied waits.
+ * Pointer to the wait list whose satisfied wait blocks
+ * will be moved away.
*
* @return None.
*
@@ -325,7 +327,7 @@
*--*/
VOID
NTAPI
-CsrMoveSatisfiedWait(IN PLIST_ENTRY NewEntry,
+CsrMoveSatisfiedWait(IN PLIST_ENTRY DestinationList,
IN PLIST_ENTRY WaitList)
{
PLIST_ENTRY NextEntry;
@@ -352,8 +354,8 @@
/* Remove it from the Wait Block Queue */
RemoveEntryList(&WaitBlock->WaitList);
- /* Insert the new entry */
- InsertTailList(&WaitBlock->WaitList, NewEntry);
+ /* Insert the wait into the destination list */
+ InsertTailList(DestinationList, &WaitBlock->WaitList);
}
}
@@ -365,10 +367,10 @@
* @name CsrNotifyWait
* @implemented NT4
*
- * The CsrNotifyWait notifies a CSR Wait Block.
+ * The CsrNotifyWait notifies CSR Wait Blocks.
*
* @param WaitList
- * Pointer to the list entry for this wait.
+ * Pointer to the wait list whose wait blocks will be notified.
*
* @param WaitType
* Type of the wait to perform, either WaitAny or WaitAll.