Q:

How to create STA threads in SmartThreadPool

I am using SmartThreadPool by Ami Bar 
http://www.codeproject.com/KB/threads/smartthreadpool.aspx
Although it is mentioned there that STA threads can be spawned, but i couldn't find an example. I want to create all STA threads in my pool.

A:

That's a bad idea.  The lifetime of a threadpool thread is determined by the code it executes, preferably short and snappy.  This is not the rule for an STA thread, it must stay active and pump a message loop as long as the COM objects that were created on that thread are not finalized.  A requirement that's very incompatible with a TP thread.  Trying to do this anyway will just buy you never-ending misery with "COM object that has been separated from its underlying RCW cannot be used" exceptions as well as deadlock.  This is why a .NET tp thread is always MTA.
You must use a regular Thread.

