• 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: unable to break out of runloop because timers are fired andthen the loop waits
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unable to break out of runloop because timers are fired andthen the loop waits


  • Subject: Re: unable to break out of runloop because timers are fired andthen the loop waits
  • From: email@hidden
  • Date: Wed, 24 Sep 2008 23:26:01 +0000
  • Importance: Normal
  • Sensitivity: Normal

He said in another message that he didn't want to poll... In that case the only option is to ensure an input source fires or to use a CFRunLoop instead.

Sent via BlackBerry from T-Mobile

-----Original Message-----
From: Muraviev Dmitry <email@hidden>

Date: Wed, 24 Sep 2008 23:30:45
To: Jason Bobier<email@hidden>
Cc: Cocoa Developers<email@hidden>
Subject: Re: unable to break out of runloop because timers are fired and
	then the loop waits


This works fine:


NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
mTimer = [[NSTimer alloc] initWithFireDate: ... interval: ...
target:self selector:@selector(...:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer
forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer
forMode:NSModalPanelRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer
forMode:NSEventTrackingRunLoopMode];
while (...) [[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:1.]];
[pool release];




On 24.09.2008, at 23:15, Jason Bobier wrote:

> Hey folks, I have a runloop on a thread that looks like this:
>
> while (! _cancelled) {
> 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>
> 	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate
> distantFuture]];
> 	[pool release];
> }
>
> And I put a timer in the loop that sets _cancelled to true, the
> runloop never stops. What's the proper way to do this?
>
> Thanks,
>
> Jason
> _______________________________________________
>
> 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

_______________________________________________

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
_______________________________________________

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

References: 
 >unable to break out of runloop because timers are fired and then the loop waits (From: Jason Bobier <email@hidden>)
 >Re: unable to break out of runloop because timers are fired and then the loop waits (From: Muraviev Dmitry <email@hidden>)

  • Prev by Date: Merging 3 JPG images into one panoramic image
  • Next by Date: Re: setPrimitiveValue:forKey: and to-many relationships
  • Previous by thread: Re: unable to break out of runloop because timers are fired and then the loop waits
  • Next by thread: setPrimitiveValue:forKey: and to-many relationships
  • Index(es):
    • Date
    • Thread