Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Problem breaking loop (with close button) in main thread
Re: Problem breaking loop (with close button) in main thread [message #59040 is a reply to message #59039] Wed, 19 October 2022 02:21 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 656
Registered: March 2007
Contributor
Hi Awksed:

My bad. Your code goto again; only when WaitForSingleEvent fails. I was thinking in the context that it has been converted into a while loop. Smile

Quote:

Is there some way in U++ to allow the close button to call Close() while the main thread is looping
(like Windows PumpWaitingMessages())?

I would use ProcessEvents() in the loop. No idea how it will cause failure in your case. Maybe you can add a flag in Paint() to not call GuiAcquireMutex(..) again if there is a previous call not completed yet?

I would think the ProcessEvents should be inserted somewhere in your GuiAcquireMutex function (before jump back to again maybe), but it's somewhere else needs to be changed accordingly if problem arose because of it.

[Updated on: Wed, 19 October 2022 02:22]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dealing with background tasks elegantly in a userinterface
Next Topic: error / memory leak in HttpServer example
Goto Forum:
  


Current Time: Mon May 12 11:17:07 CEST 2025

Total time taken to generate the page: 0.00904 seconds