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 6913901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:16:39+00:00 2026-05-27T09:16:39+00:00

I have a class created to act as a thread. In that class, I

  • 0

I have a class created to act as a thread.

In that class, I create an object. This objects has an event which performs a callback to a method created within my thread class.

So then, my main application/GUI thread creates this thread & starts it.

At this point, my main GUI thread sits idle (awaiting keyboard events) & my thread’s execute method sits in an infinite loop (waiting for terminate).

Then, the created object detects something, firing an event, which triggers the call-back to the thread classes method.

The question then is, which thread/process is this method performed in?
My main application thread (& GUI handler)?
Or the thread I started, which created the object that fired the event/callback?

I’m presuming that the main application thread is interrupted. Is this right?

  • 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-27T09:16:40+00:00Added an answer on May 27, 2026 at 9:16 am

    There is no magic here, the event handler simply runs on the same thread as the code that fired the event. Which is invariably troublesome when you want the event handler to update the UI, that isn’t legal to do from any thread other than the one that created the UI objects.

    You will have to marshal the call from the worker thread to the UI thread. That’s always supported by whatever class library you use the implement the UI. You didn’t say, it smells like Winforms in which case you use Control::BeginInvoke(). If it is raw Windows then you use PostMessage(). Etcetera.

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

Sidebar

Related Questions

I have created a class for a dashboard item which will hold information such
I have created a class library called AddServiceLibrary in which I have a method
I have a collection of classes that inherit from an abstract class I created.
I am using C#. I have created a class which can be included in
I am using the apache library. I have created a class which sends a
I have written a class (AbcdBase) which holds several static objects, these include maps
We have a restriction that a class cannot act as a base-class for more
I have created a VB.NET Class Library that exposes some COM Interop sub routines.
I have created a class, that makes it easy to enter in the amount
I have a class which accumulates information about a set of objects, and can

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.