On 4 Sep 2008, at 2:40 pm, D.K. Johnston wrote:

        // wait 10 seconds
        NSUInteger i = 0, resume = time( nil ) + 10;
        while( i < resume )
                index = time( nil );



Don't do this!

This is not a good way to wait for a period of time, even if waiting for a period of time were a good way to do what you want (which it isn't). All this does is chew up CPU time - events will still be captured and queued while this is running, so when it ends, they just get processed and passed to the now enabled control. Also, as posted the above code never terminates - i is never changed.

What's to say your "data display" always takes 10 seconds anyway? Depends on the data, the machine you're running on, etc, etc... time delay loops are what a first-timer using BASIC uses - real programmers never do this.

Disable the matrix at the start of data load. When the data load finishes, signal that fact to some object that re-enables the control. Load the data asynchronously (using a thread or timer-driven loop).

hth,

Graham

_______________________________________________

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]

Reply via email to