On 2 May '08, at 9:32 AM, Western Botanicals wrote:
The reason I put the AutoReleasePools in there is because I am getting these errors in the output. So if you can help me find what is wrong that would be great. Every time I create a Date or Timer object, I get one or both of these:
You're probably running this as a GUI-less tool process, i.e. directly calling your code from main(). If you do this, you need to create a top-level autorelease pool before calling into your code. In general, main() looks like:
int main( int argc, const char **argv ) {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
int result = 0;
// your program code goes here
[pool drain];
return result;
}
In a GUI application (or even a runloop-based tool) you don't have to
worry about this, because NSRunLoop makes sure to create an
autorelease pool whenever it calls into application code.
Speaking of runloops, your test code needs to idle the runloop in between its tests, to give the timer a chance to expire entries. You currently have some (commented-out) usleep calls, but those won't work, because the runloop is on your thread and has to be explicitly given time to run. You can replace those with [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.25];
—Jens
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
