ISAPI Filter : Can be multithreaded ?

ISAPI Filter : Can be multithreaded ?

am 28.06.2007 11:31:16 von Stephane Wirtel

With the filter model, is there a way to get an multithreaded isapi filter ?

I use Visual Studio 2005 and so, I work with VC++.

I don't want to work with MFC, but with Win32.

Can I initialize a thread pool in GetFilterVersion ?

Best Regards,

Stephane Wirtel

Re: ISAPI Filter : Can be multithreaded ?

am 28.06.2007 16:17:43 von wadeh

Hi Stephane,

All ISAPI filters are, by there very nature, multithreaded. This is because
IIS can and will call into HttpFilterProc multiple, concurrent times on
different threads. The ramification here is that any code that you put in a
filter must be thread safe.

When you ask about a thread pool, you are implying a different question,
though. You can certainly initialize a thread pool in GetFilterVersion if
you want to. It might be of limited use, though, because filters are
sychronous. By this, I mean that once IIS's thread calls into your entry
point, there is no way to return the thread back to IIS without first
finishing the work you need to do in that notification.

This is a different model than ISAPI extensions, which can be fully
asynchronous. ISAPI extensions can (and should) queue the request to a
private thread pool inside HttpExtensionProc and then return
HSE_STATUS_PENDING to give the thread back to IIS. Using this mechanism,
ISAPI extensions can support complex, long running operations without
artifically harming server scalability.

ISAPI filters cannot support the long running tasks that extensions can -
and you should never do long running operations in a filter (and this
includes building and sending back responses to the client.)

Thank you,
-Wade A. Hilmo,
-Microsoft

PS: If you have further questions on this, or any other, ISAPI issue,
please feel free to post them to
microsoft.public.platformsdk.internet.server.isapi-dev, which exists for
this purpose.

"Stephane Wirtel" wrote in message
news:f5vtud$9du$1@news.brutele.be...
> With the filter model, is there a way to get an multithreaded isapi filter
?
>
> I use Visual Studio 2005 and so, I work with VC++.
>
> I don't want to work with MFC, but with Win32.
>
> Can I initialize a thread pool in GetFilterVersion ?
>
> Best Regards,
>
> Stephane Wirtel