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#
  4. delegate context

delegate context

Scheduled Pinned Locked Moved C#
question
2 Posts 2 Posters 0 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.
  • A Offline
    A Offline
    albean
    wrote on last edited by
    #1

    An instance of MyClass is running in Thread A. This instance of MyClass instantiates an instance of YourClass. As part of the constructor of YourClass a worker thread (Thread B) is started. When this worker is completed it calls a delegate callback function in MyClass. In which thread context is the delegate function executed? Thread A or B?

    M 1 Reply Last reply
    0
    • A albean

      An instance of MyClass is running in Thread A. This instance of MyClass instantiates an instance of YourClass. As part of the constructor of YourClass a worker thread (Thread B) is started. When this worker is completed it calls a delegate callback function in MyClass. In which thread context is the delegate function executed? Thread A or B?

      M Offline
      M Offline
      Mark Smithson
      wrote on last edited by
      #2

      I think that any function called from a delegate will normally be executed on a thread from the thread pool. Thus it will not be executed on Thread A or Thread B. I have some memory of a way of getting a delegate to execute on a particular thread, but can't recall the details right now.

      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