• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Call back to the run loop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Call back to the run loop?


  • Subject: Call back to the run loop?
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Sun, 17 Mar 2002 21:27:55 +0100

Following the discussion with Dietmar Planitzer (see previous messages), I would like to ask to the list if there is a way to call back the main run loop of the app. It's a little bit complicated, so excuse in advance my embarassed english.

The reason I ask is the following (maybe there are better solution than a call back):
as explained before my app uses a large part of code coming from another platform, which I don't want to change. It's a computational thing, meaning the user enters some data, then hit a button "Run"; then some computations are in progress, then a result is displayed.

The point is that the original app has a button "Stop" and I can't find a way to implement it. The app stream is as follows:
- the action for "Run" sarts a "compute()" function;
- in the loop of this function, there is a call back "updateUI()" which I use to update the UI (the number of computed things is displayed);
- but this function compute() doesn't return until computation is complete or a special global variable "g_computing" is set to false.

So I would like to set this variable to false when the user hit the "Stop"
button, but this doesn't work since there is no pass in the main run loop,
so no chance to detect the hit. Hence the question: is it possible to have a pass through the main run loop (starting from updateUI for instance)
? Or is there another way to suspend "compute()" for a while, return to the main run loop, and resume?

I know I could use a multithreaded app, but this would be really very complicated just to get a "Stop" button.

Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Call back to the run loop?
      • From: Eric Peyton <email@hidden>
  • Prev by Date: Re: abstract object of class NSCFDictionary?
  • Next by Date: Re: How to use a subclass of NSTextView inside a NSScrollView?
  • Previous by thread: Re: Some good docs viewer?
  • Next by thread: Re: Call back to the run loop?
  • Index(es):
    • Date
    • Thread