• 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 16:40:52 -0600

Yes, clarification please as I thought I would not see the desired behavior
if +sleepUntilDate:duration was called on the main thread.





On 7/10/04 4:33 PM, "Fritz Anderson" <email@hidden> wrote:

> Umm... somebody please correct me, but I believe CFStream callbacks
> occur on the main thread, at least if the asynchronous call that led to
> the callback being issued was on the main thread. CFStream, if I
> recall, works by adding inputs to the current run loop, not (so far as
> the caller is concerned) by threading.
>
> -- F
>
> On 10 Jul 2004, at 2:26 PM, David Blanton wrote:
>
>> 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.
_______________________________________________
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.


References: 
 >Re: NSThread sleepUntilDate /CORRECTION (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Bindings paradigm
  • Next by Date: Re: plist issues driving me crazy
  • Previous by thread: Re: NSThread sleepUntilDate /CORRECTION
  • Next by thread: Re: NSThread sleepUntilDate
  • Index(es):
    • Date
    • Thread