• 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 sleepUntilDate /CORRECTION
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread sleepUntilDate /CORRECTION


  • Subject: Re: NSThread sleepUntilDate /CORRECTION
  • From: David Blanton <email@hidden>
  • Date: Sat, 10 Jul 2004 13:26:31 -0600

This is not done in the main thread. It is called from a CFStream call back
funtion. Sorry for the mistake.


On 7/10/04 1:20 PM, "David Blanton" <email@hidden> wrote:

> The code snippet I sent was incorrect as an -sleepUntilDate: is a factory
> method. The following called in the main thread works just fine.
>
> NSDate * d = [NSDate dateWithTimeIntervalSinceNow:g_DelayValue];
> [NSThread sleepUntilDate:d];
>
>
>
>
>
> On 7/10/04 11:52 AM, "Daniel Todd Currie" <email@hidden> wrote:
>
>> Yes, but if I am not mistaken, this will also stall your app if
>> -sleepUntilDate: is called in the main thread. I would personally
>> recommend using an NSTimer.
>>
>> -- DTC
>>
>>
>> On 2004 Jul 10, at 10:02, David Blanton wrote:
>>
>>> Given this description of NSThread:
>>>
>>>
>>> An NSThread object controls a thread of execution. Use NSThread when
>>> you
>>> want to have an Objective-C method run in its own thread of execution
>>> or if
>>> you need to terminate or delay the current thread.
>>>
>>>
>>> I want to do some stuff then wait for an interval (20 seconds) before
>>> doing
>>> the next instruction. Is sleepUntilDate the way to do this? In the
>>> old Mac
>>> days you could use delay(...) at some point in the code. This is the
>>> behavior for which I am looking.
>>>
>>> NSDate * d = [NSDate dateWithTimeIntervalSinceNow:20]
>>> NSThread * t = [NSThread currentThread];
>>> [t sleepUntilDate:d]
>>>
>>> // should this code wait here for 20 seconds before doing the next
>>> //instruction?
>>> _______________________________________________
>>> 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.
>> _______________________________________________
>> 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.
> _______________________________________________
> 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.
_______________________________________________
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: NSThread sleepUntilDate /CORRECTION
      • From: Fritz Anderson <email@hidden>
References: 
 >Re: NSThread sleepUntilDate (From: David Blanton <email@hidden>)

  • Prev by Date: Re: NSThread sleepUntilDate
  • Next by Date: Re: NSThread sleepUntilDate
  • Previous by thread: Re: NSThread sleepUntilDate
  • Next by thread: Re: NSThread sleepUntilDate /CORRECTION
  • Index(es):
    • Date
    • Thread