Re: Of input loops and games
Re: Of input loops and games
- Subject: Re: Of input loops and games
- From: Hari Seldon <email@hidden>
- Date: Wed, 21 Sep 2005 17:29:10 -0500
Thanks for your reply.
On 9/21/05, Sherm Pendley <email@hidden> wrote:
> You can "stack" as many autorelease pools as you need. When a new
> pool is created, it's added to the top of the stack. When an object
> is autoreleased, it's added to the top pool on the stack.
>
> AppKit creates a new autorelease pool at the beginning of each
> iteration through its run loop, and releases that pool at the end.
> You could do something similar. In pseudo-code:
I was aware of that; I'm under the impression that if I create a new
thread, I don't get to use AppKit's automatically created autorelease
pool.
>
> - (void)start_move_loop() {
> int end_loop = 0;
> while (end_loop == 0) {
> NSAutoreleasePool *subPool = [[NSAutoreleasePool alloc] init];
>
> // Call get_key() and handle game events
>
> [subPool release];
> }
> }
>
Sadly, I don't have "control" over the start_move_loop function --
it's built into the original C code. Is it possible to clear the pool
on a timer, or would that raise problems?
> sherm--
>
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org
>
>
_______________________________________________
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