releasing resources for Worker thread

If I queue a work item with ExInitializeWorkItem / ExQueueWorkItem, do I
need to call anything to free it? Or do I just return from the thread.
E.g.,

ioContext = ExAllocatePool(NonPagedPool, #);
ExInitializeWorkItem( &ioContext->WorkItem,WorkerThread, ioContext );
ExQueueWorkItem( &ioContext->WorkItem, CriticalWorkQueue );

WorkerThread(context)
{
… do stuff …
ExFreePool(context);
return (status) ; // does this release the workerthread
resources?
}

Thanks for any pointers (no pun intended).

Neil

You must not free any resources (except the memory where work item lives,
and even this is not so - it can be in the device extension sometimes).
IoxxxWorkItem, on the other hand, require IoFreeWorkItem.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Neil Weicher”
To: “Windows File Systems Devs Interest List”
Sent: Monday, December 01, 2003 8:41 PM
Subject: [ntfsd] releasing resources for Worker thread

> If I queue a work item with ExInitializeWorkItem / ExQueueWorkItem, do I
> need to call anything to free it? Or do I just return from the thread.
> E.g.,
>
> ioContext = ExAllocatePool(NonPagedPool, #);
> ExInitializeWorkItem( &ioContext->WorkItem,WorkerThread, ioContext );
> ExQueueWorkItem( &ioContext->WorkItem, CriticalWorkQueue );
>
> …
>
> WorkerThread(context)
> {
> … do stuff …
> ExFreePool(context);
> return (status) ; // does this release the workerthread
> resources?
> }
>
> Thanks for any pointers (no pun intended).
>
> Neil
>
>
> —
> Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com