Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Carbon sleep?



Yep looks good to me.

On Thursday, February 28, 2002, at 09:45 AM, Steve Baxter wrote:

Why not allocate finalCount on the stack (no point in making work for
yourself). Also, this will leak 4 bytes every time it is called.

Simpler is:

UInt32 finalCount;
Delay((5*60),&finalCount);

That's it!

Cheers,

Steve.

--
Stephen Baxter
Development Manager
Improvision
email@hidden
Tel:+44-2476-692229
Fax:+44-2476-690091

------------------------------------------------------
Volocity - New Dimensions in High Performance Imaging

http://www.improvision.com/products/Volocity
------------------------------------------------------


From: bholbert <email@hidden>
Date: Thu, 28 Feb 2002 09:30:02 -0600
To: email@hidden
Subject: Re: Carbon sleep?

Ok since this has generated alot of mail here's the total code ;)

#include <CoreServices/CoreServices.h>

UInt32 *finalCount;

finalCount = (UInt32*)malloc(sizeof(UInt32));

Delay((5*60),finalCount); //This is a 5 second delay I think since the
doc said a tick is 1/60 of a second...anyway it seems to work for me.

I forgot that part and the program did crash, then I put it in and all
went well.
thanks
Brian


On Thursday, February 28, 2002, at 06:40 AM, Jesper Papmehl wrote:

2002-02-28 04.00, bholbert <email@hidden> wrote:

just for others that might be interested

#include <CoreServices/CoreServices.h>

UInt32 *finalCount;

Delay((5*60),finalCount); //This is a 5 second delay I think since the
doc said a tick is 1/60 os a second...anyway it seems to work for me.

Hmm... Maybe I'm wrong, but couldn't that crash?
Delay returns the final tickcount in the finalCount parameter. In the
code
above, finalCount points to some random memory area, so Delay will write
four bytes into some random place in memory.
I think
UInt32 finalCount;
Delay((5*60),&finalCount);
would be much safer.

Right?


/Jesper
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Carbon sleep? (From: Steve Baxter <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.