• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 580
  • Last Modified:

Does an event handler function run as a separate thread?

Say I have a event handler function OnCallingSomeFunction

i.e. ON_COMMAND(ID_OPTION_SOME_FUNCTION, OnCallingSomeFunction)

when a user activates this function, does it run as a separate thread? if a user activates it a second time before the first call is finished, would these 2 calls be running in separate threads?

thanks
0
DrivenX
Asked:
DrivenX
  • 2
  • 2
1 Solution
 
jkrCommented:
No, MFC in general runs all UI related functions in one (the main) thread, so what you lined out should not happen. What you however can do is launching a thread for processing in that event handler and return immediately.
0
 
DrivenXAuthor Commented:
Thanks jkr

Just a little bit confused.  Then, should the application wait for one handler function to finish before executing another?  It seems that 2 handler functions are running at the same time in my application.
0
 
jkrCommented:
That would be really odd, unless you kick off another thread by yourself. However, when the handler just creates a window and returns then, this would be possible, since the "parallelism" would be possible through messaging then.
0
 
DrivenXAuthor Commented:
Hmm my handler does involve calling a CWnd derived class' function, perhaps that's why.  Although it the handler function does not return right away.

Thanks jkr
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now