Thread: assign none to COM thread model

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    assign none to COM thread model

    Hello everyone,


    As mentioned in the book ATL Internals, when assign none to COM thread model,

    --------------------
    If there is no ThreadingModel given in the registry, COM will assume a legacy single-threaded class and access the class object from the process's first STA, creating a new STA is necessary. This protects objects from having to synchronize access to global, static, or instance data.
    --------------------

    I do not understand why "This protects objects from having to synchronize access to global, static, or instance data"? Any ideas?


    thanks in advance,
    George

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    If all those objects live in the same STA then they all execute in the same thread, meaning that there are no threading synchronisation issues to worry about.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks iMalc,


    Question answered.

    Quote Originally Posted by iMalc View Post
    If all those objects live in the same STA then they all execute in the same thread, meaning that there are no threading synchronisation issues to worry about.

    regards,
    George

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Terminating secondary thread from another thread
    By wssoh85 in forum C++ Programming
    Replies: 13
    Last Post: 12-19-2008, 05:14 AM
  2. Thread Prog in C language (seg fault)
    By kumars in forum C Programming
    Replies: 22
    Last Post: 10-09-2008, 01:17 PM
  3. Shared memory implementation using thread
    By kumars in forum C Programming
    Replies: 5
    Last Post: 06-18-2008, 04:24 AM
  4. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  5. Critical Sections, destroying
    By Hunter2 in forum Windows Programming
    Replies: 4
    Last Post: 09-02-2003, 10:36 PM