Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC thread affinity and COM

MFC thread affinity and COM

Scheduled Pinned Locked Moved C / C++ / MFC
c++com
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xcavin
    wrote on last edited by
    #1

    avoid using MFC in COM srevers as it has thread affinity. wot does this means exactly . !!! Thanks in advance.

    P 1 Reply Last reply
    0
    • X xcavin

      avoid using MFC in COM srevers as it has thread affinity. wot does this means exactly . !!! Thanks in advance.

      P Offline
      P Offline
      palbano
      wrote on last edited by
      #2

      This should help. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Multithreading.3a_.Programming_Tips.asp[^]

      -- signature under construction --

      -pete

      X 1 Reply Last reply
      0
      • P palbano

        This should help. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Multithreading.3a_.Programming_Tips.asp[^]

        -- signature under construction --

        -pete

        X Offline
        X Offline
        xcavin
        wrote on last edited by
        #3

        can you tell me wot thread affinity means, in a single sentence also fine.

        2 P 2 Replies Last reply
        0
        • X xcavin

          can you tell me wot thread affinity means, in a single sentence also fine.

          2 Offline
          2 Offline
          224917
          wrote on last edited by
          #4

          most of the MFC objects internally uses local thread storage extensively. so they are bound to their owner thread, and not supposed to be shared with other threads. this is why MFC has thread affinity.


          It's not a bug, it's an undocumented feature.
          suhredayan@gmail.com

          1 Reply Last reply
          0
          • X xcavin

            can you tell me wot thread affinity means, in a single sentence also fine.

            P Offline
            P Offline
            palbano
            wrote on last edited by
            #5

            To have thread affinity means to be "bound to the thread". Therefore the object can only be used safely from that thread. In the case of MFC, some objects are bound to threads through MFCs use of Thread Local Storage. Attempting to use the object in a thread other than the thread it is bound to will result in errors since the thread local storage data is not present. Hope that helps?

            -- signature under construction --

            -pete

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups