• 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
Re: NSThread, drawing and waiting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread, drawing and waiting


  • Subject: Re: NSThread, drawing and waiting
  • From: Dirk Stegemann <email@hidden>
  • Date: Wed, 27 Jul 2005 00:59:09 +0300

Hi,

Am 27.07.2005 um 00:33 schrieb Damien Sorresso:

The `RNRequirementManager' has an array of `RNRequirement' items that it goes through and calls the ``searchForItem" methods for. Here's what that code looks like.

for( i = 0; i < numResults; i++ ) {
   int condition = [[requirementsArr objectAtIndex:i] lockCondition];
   [conditionLock lock];
   [conditionLock unlockWithCondition:condition];

   [NSThread detachNewThreadSelector:@selector(searchForItem)
                        toTarget:[requirementsArr objectAtIndex:i]
                      withObject:nil];

   [conditionLock lockWhenCondition:0];
   [conditionLock unlock];

   // Tell delegate what to do
   // ...
}


I had pretty much success by spawning a "worker" thread to do the heavy work; then every time I wanted the GUI being updated using information created by this worker thread, it used NSObject's

- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait;

method to run a tiny method which updates the GUI accordingly.


Regards, Dirk Stegemann _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSThread, drawing and waiting
      • From: Damien Sorresso <email@hidden>
References: 
 >NSThread, drawing and waiting (From: Damien Sorresso <email@hidden>)

  • Prev by Date: Re: Creating a 2nd sheet from another sheets end handler.
  • Next by Date: Setting vertical alignment for a NSTextFieldCell ?
  • Previous by thread: NSThread, drawing and waiting
  • Next by thread: Re: NSThread, drawing and waiting
  • Index(es):
    • Date
    • Thread