Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7640973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:48:23+00:00 2026-05-31T08:48:23+00:00

I created a Windows NT service, which exports a COM interface using ATL (out-of-proc

  • 0

I created a Windows NT service, which exports a COM interface using ATL (out-of-proc COM), I do API calls CoInitializeEx (0, COINIT_MULTITHREADED) in the Ctor(), CoUninitialize () in the Dtor() of the class of my object?

Reading Fashionable App Designers Agree: The Free Threading Model is What’s Hot This Fall and Give ActiveX-based Web Pages a Boost with the Apartment Threading Model did nothing to clarify.

My ATL project have declaration of :

#define _ATL_FREE_THREADED
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:48:24+00:00Added an answer on May 31, 2026 at 8:48 am

    For an out-of-process ATL server that’s already taken care of by the CAtlExeModuleT constructor. It will call InitializeCom() in its constructor. When you’ve #defined _ATL_FREE_THREADED, that will automatically produce a call to CoInitializeEx(NULL, COINIT_MULTITHREADED), as you’d expect. The code is easy to find back in vc/atlmfc/include/atlbase.h

    Interface method calls will be made from the stub by an RPC thread, the actual thread that makes the call is entirely unpredictable. Pretty dangerous too because RPC recycles threads and the calls are often made by the same thread. But not always, depending on how many concurrent calls are being processed. The burden of supporting free threading is to ensure that your code is entirely thread-safe. If you have any bugs of the deadlock or threading race kind or rely on a synchronization object that has thread-affinity like Mutex across multiple calls then they won’t ruin your day until the server gets heavily loaded. Be sure to test this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an installation package using Wix which installs a Windows service on
I created windows service using csharp in that i am accessing shared folders which
I'm using VB9 (VS2008). I've created a Windows Service that indexes some folders regularly.
I created a WCF service which is hosted in windows service. I created a
I have created a Windows Service (called MuskOx) which runs on my development machine
I've created a windows service in VS 2010 which references the model conveniently placed
I have created a windows service which is currently having three timers. First timer
I have created a windows service which interacts with SQL Server Express Edition. I
I recently created a windows service which can wear various hats depending on what
HI Guys, I have created a windows service which spawns three threads.The first thread

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.