• 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: to implement a 1 sec repeating timer in a separate thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: to implement a 1 sec repeating timer in a separate thread


  • Subject: Re: to implement a 1 sec repeating timer in a separate thread
  • From: Dave Keck <email@hidden>
  • Date: Wed, 21 Oct 2009 23:02:15 -1000

I'm having a really hard time making sense of you message...
> I have been trying to implement a 1 second repeating timer, but its
leading
> to retaining the target object

That's expected behavior - NSTimers retain their targets. The target won't
be deallocated until the timer has been invalidated (assuming the timer was
the only thing keeping the target alive.)

> But its leading to referencing the target object of my thread, by 3-4
> non-objects (bytes), which shows different descriptions every time as per
GC
> Monitor Instrument (kind of undefined behavior).

Woah, this sentence has my completely baffled:

 o Prior to this sentence, you were talking about retaining/releasing, not
you're talking about garbage collection. I think I'm still following you
though - regardless, the timer is keeping the target alive.

 o 3-4 bytes of what? Why do these bytes matter?

========== Moment of clarity in 3... 2... 1...

Oh. I think you're just trying to have a method called every second. If
that's the case, no need to concern yourself with threads and... well,
whatever it is that's going on in that code snippet. :D

   [NSTimer scheduledTimerWithTimeInterval: 1.0 target: self
selector: @selector(doSomething:) userInfo: nil repeats: YES];

That will call self's -doSomething: method every second. Is that what you're
trying to accomplish?
_______________________________________________

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: to implement a 1 sec repeating timer in a separate thread
      • From: Nick Rogers <email@hidden>
References: 
 >to implement a 1 sec repeating timer in a separate thread (From: Nick Rogers <email@hidden>)

  • Prev by Date: to implement a 1 sec repeating timer in a separate thread
  • Next by Date: Re: "Sticky" Event tracking
  • Previous by thread: to implement a 1 sec repeating timer in a separate thread
  • Next by thread: Re: to implement a 1 sec repeating timer in a separate thread
  • Index(es):
    • Date
    • Thread