Results 1 to 3 of 3

Thread: [RESOLVED] Raise event after thread end

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    172

    Resolved [RESOLVED] Raise event after thread end

    Hi, how can I raise an event after a thread has just ended?

    Thanks

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Raise event after thread end

    The BackGroundWorker will do this automatically, so I assume that you are talking about a plain thread. One option would be to switch to using the BackGroundWorker so that you get the event, and the other option is to raise the event as the final act of the thread.

    For that second option, I save the SynchronizationContext of the UI thread, then Post a call to a sub in UI context that raises the event. By doing this, the event is raised in the UI thread, not in the background thread. If you want more information on that, search for my name and SynchronizationContext, as I have posted examples a couple of times. However, the BackGroundWorker object sounds like it may be more appropriate for you.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    172

    Re: Raise event after thread end

    OK thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width