• 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: Make a NSThread fall asleep and awake it.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make a NSThread fall asleep and awake it.


  • Subject: Re: Make a NSThread fall asleep and awake it.
  • From: The Karl Adam <email@hidden>
  • Date: Tue, 9 Nov 2004 18:54:28 -0500

Why make the thread sleep at all?
You could promote this thread to an NSRunLoop by calling [[NSRunLoop
currentRunLoop] run] before your release your pool, then your thread
is guaranteed to stay around and consume no resources till necessary.
Of course you would then need an NSTimer on it to preiodically check
for the events that it's supposed to.  Or if your callback is supposed
to talk to the object in this thread then set up and Distributed
Objects connection with NSConnection to talk to this thread on.


On Tue, 9 Nov 2004 16:16:48 +0100, ROUGE Alex
<email@hidden> wrote:
> Hello everybody,
> I have some threads in my application, created using the following
> command...
>
>         [NSThread detachNewThreadSelector:@selector(generationNumber)
> toTarget:self withObject:nil];
>
> Then on my generationNumber process I put those lines...
>
>      NSAutoreleasePool * localPool = [[NSAutoreleasePool alloc] init];
> ...
> ...
> ...
>
>         [localPool release];
>
> On the generation process I just do a while which print number from 0
> to n
>
> Then, I wish I can make this thread sleep, like...
> If I press a button, the process would be sleepy and then make it awake.
>
> In fact generationProcess must fall asleep by itself.
> I use this to make a callback in fact, so thank for your nices replies.
>
> Alex
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Make a NSThread fall asleep and awake it. (From: ROUGE Alex <email@hidden>)

  • Prev by Date: Re: Nibs and memory leaks
  • Next by Date: Missing Scroller in NSTableView
  • Previous by thread: Make a NSThread fall asleep and awake it.
  • Next by thread: Re: Make a NSThread fall asleep and awake it.
  • Index(es):
    • Date
    • Thread