Threading Models in OLE-DB

Using VC++6.0 I've created an ATL project and added an OLE DB template data provider.  The default registration is for Apartment threading.

What can be done to change this code to Free Threading or Both.

Who is Participating?
GlennDeanConnect With a Mentor Commented:
In your inheritance heirarchy, ATL will inherit CComObjectRootEx.  Instead of accepting the default template parameter of CComSingleThreadModel you can manually change it to CComMultiThreadModel.  This will change your threading model to what you want.  COM/DCOM can put your component in its own STA or an MTA since you're guaranteeing that it provides its own synchronization to global resources.
All Courses

From novice to tech pro — start learning today.