mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 21:48:19 +00:00
- Re-use WorkItem
- Fixes leaking a workitem for each pin creation request svn path=/trunk/; revision=40360
This commit is contained in:
parent
8d5edefc0e
commit
edb9b66280
3 changed files with 5 additions and 15 deletions
|
@ -10,9 +10,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "private.h"
|
#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
|
This is called from DriverEntry so that PortCls can take care of some
|
||||||
|
@ -152,6 +149,9 @@ PcAddAdapterDevice(
|
||||||
/* clear initializing flag */
|
/* clear initializing flag */
|
||||||
fdo->Flags &= ~ DO_DEVICE_INITIALIZING;
|
fdo->Flags &= ~ DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
|
/* allocate work item */
|
||||||
|
portcls_ext->WorkItem = IoAllocateWorkItem(fdo);
|
||||||
|
|
||||||
/* allocate the device header */
|
/* allocate the device header */
|
||||||
status = KsAllocateDeviceHeader(&portcls_ext->KsDeviceHeader, MaxObjects, portcls_ext->CreateItems);
|
status = KsAllocateDeviceHeader(&portcls_ext->KsDeviceHeader, MaxObjects, portcls_ext->CreateItems);
|
||||||
/* did we succeed */
|
/* did we succeed */
|
||||||
|
|
|
@ -500,7 +500,6 @@ PcCreateItemDispatch(
|
||||||
IIrpTarget *Filter;
|
IIrpTarget *Filter;
|
||||||
PKSOBJECT_CREATE_ITEM CreateItem;
|
PKSOBJECT_CREATE_ITEM CreateItem;
|
||||||
PPIN_WORKER_CONTEXT Context;
|
PPIN_WORKER_CONTEXT Context;
|
||||||
PIO_WORKITEM WorkItem;
|
|
||||||
|
|
||||||
DPRINT("PcCreateItemDispatch called DeviceObject %p\n", DeviceObject);
|
DPRINT("PcCreateItemDispatch called DeviceObject %p\n", DeviceObject);
|
||||||
|
|
||||||
|
@ -599,20 +598,11 @@ PcCreateItemDispatch(
|
||||||
Context->Filter = Filter;
|
Context->Filter = Filter;
|
||||||
Context->Irp = Irp;
|
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());
|
DPRINT("Queueing IRP %p Irql %u\n", Irp, KeGetCurrentIrql());
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Irp->IoStatus.Status = STATUS_PENDING;
|
Irp->IoStatus.Status = STATUS_PENDING;
|
||||||
IoMarkIrpPending(Irp);
|
IoMarkIrpPending(Irp);
|
||||||
IoQueueWorkItem(WorkItem, CreatePinWorkerRoutine, DelayedWorkQueue, (PVOID)Context);
|
IoQueueWorkItem(DeviceExt->WorkItem, CreatePinWorkerRoutine, DelayedWorkQueue, (PVOID)Context);
|
||||||
|
|
||||||
return STATUS_PENDING;
|
return STATUS_PENDING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ typedef struct
|
||||||
ULONG MaxSubDevices;
|
ULONG MaxSubDevices;
|
||||||
KSOBJECT_CREATE_ITEM * CreateItems;
|
KSOBJECT_CREATE_ITEM * CreateItems;
|
||||||
|
|
||||||
|
PIO_WORKITEM WorkItem;
|
||||||
IResourceList* resources;
|
IResourceList* resources;
|
||||||
LIST_ENTRY SubDeviceList;
|
LIST_ENTRY SubDeviceList;
|
||||||
LIST_ENTRY PhysicalConnectionList;
|
LIST_ENTRY PhysicalConnectionList;
|
||||||
|
|
Loading…
Reference in a new issue