Commit 8738ce85 authored by Ray Strode's avatar Ray Strode Committed by Adam Jackson

dix: ensure work queues are cleared on reset

If the server resets, most client workqueues are cleaned up as the
clients are killed.

The one exception is the server's client, which is exempt from
the killing spree.

If that client has a queued work procedure active, it won't get
cleared on reset.

This commit ensures it gets cleared too.
parent 364d6498
......@@ -507,6 +507,19 @@ InitBlockAndWakeupHandlers(void)
WorkQueuePtr workQueue;
static WorkQueuePtr *workQueueLast = &workQueue;
void
ClearWorkQueue(void)
{
WorkQueuePtr q, *p;
p = &workQueue;
while ((q = *p)) {
*p = q->next;
free(q);
}
workQueueLast = p;
}
void
ProcessWorkQueue(void)
{
......
......@@ -340,6 +340,8 @@ dix_main(int argc, char *argv[], char *envp[])
DeleteCallbackManager();
ClearWorkQueue();
if (dispatchException & DE_TERMINATE) {
CloseWellKnownConnections();
}
......
......@@ -240,6 +240,8 @@ extern _X_EXPORT void RemoveBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blo
extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
extern _X_EXPORT void ClearWorkQueue(void);
extern _X_EXPORT void ProcessWorkQueue(void);
extern _X_EXPORT void ProcessWorkQueueZombies(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment