- Re-use WorkItem

- Fixes leaking a workitem for each pin creation request

svn path=/trunk/; revision=40360
This commit is contained in:
Johannes Anderwald 2009-04-04 16:04:25 +00:00
parent 8d5edefc0e
commit edb9b66280
3 changed files with 5 additions and 15 deletions

View file

@ -10,9 +10,6 @@
*/
#include "private.h"
#include <devguid.h>
#include <initguid.h>
#include <ksmedia.h>
/*
This is called from DriverEntry so that PortCls can take care of some
@ -152,6 +149,9 @@ PcAddAdapterDevice(
/* clear initializing flag */
fdo->Flags &= ~ DO_DEVICE_INITIALIZING;
/* allocate work item */
portcls_ext->WorkItem = IoAllocateWorkItem(fdo);
/* allocate the device header */
status = KsAllocateDeviceHeader(&portcls_ext->KsDeviceHeader, MaxObjects, portcls_ext->CreateItems);
/* did we succeed */

View file

@ -500,7 +500,6 @@ PcCreateItemDispatch(
IIrpTarget *Filter;
PKSOBJECT_CREATE_ITEM CreateItem;
PPIN_WORKER_CONTEXT Context;
PIO_WORKITEM WorkItem;
DPRINT("PcCreateItemDispatch called DeviceObject %p\n", DeviceObject);
@ -599,20 +598,11 @@ PcCreateItemDispatch(
Context->Filter = Filter;
Context->Irp = Irp;
WorkItem = IoAllocateWorkItem(DeviceObject);
if (!WorkItem)
{
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
FreeItem(Context, TAG_PORTCLASS);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_INSUFFICIENT_RESOURCES;
}
DPRINT("Queueing IRP %p Irql %u\n", Irp, KeGetCurrentIrql());
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_PENDING;
IoMarkIrpPending(Irp);
IoQueueWorkItem(WorkItem, CreatePinWorkerRoutine, DelayedWorkQueue, (PVOID)Context);
IoQueueWorkItem(DeviceExt->WorkItem, CreatePinWorkerRoutine, DelayedWorkQueue, (PVOID)Context);
return STATUS_PENDING;
}

View file

@ -156,7 +156,7 @@ typedef struct
ULONG MaxSubDevices;
KSOBJECT_CREATE_ITEM * CreateItems;
PIO_WORKITEM WorkItem;
IResourceList* resources;
LIST_ENTRY SubDeviceList;
LIST_ENTRY PhysicalConnectionList;