• 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: Scheduling a selector when a thread completes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheduling a selector when a thread completes


  • Subject: Re: Scheduling a selector when a thread completes
  • From: Michael Ash <email@hidden>
  • Date: Wed, 29 Apr 2009 23:48:10 -0400

On Wed, Apr 29, 2009 at 9:55 PM,  <email@hidden> wrote:
> Hi
>
>
> I wrote a directory scanner application that spawns 4 different threads with independent rescan intervals and need to repeat the process if and only if a thread has completed a scan. Basically, for each file type I'm watching, the process is
>
>
> 1. Spawn a thread to sample files of the specified type
> 2. Wait until the thread completes
> 3. Schedule another pass after a given time interval has passed.

Seems like you're adding a lot of complication for what is essentially
a continually running operation. Instead of that, why not do this?

1. Spawn a thread.
2. Sample files.
3. Sleep.
4. Goto 2.

Or, in code:

- (void)threadMethod {
    while(1) {
        [self sampleFiles];
        sleep(5);
    }
}

Mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Scheduling a selector when a thread completes
      • From: Ken Tozier <email@hidden>
References: 
 >Scheduling a selector when a thread completes (From: email@hidden)

  • Prev by Date: Re: Building a 64-bit Preferences Pane
  • Next by Date: Re: Why is NSString->FSRef so hard?
  • Previous by thread: Re: Scheduling a selector when a thread completes
  • Next by thread: Re: Scheduling a selector when a thread completes
  • Index(es):
    • Date
    • Thread