• 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: Thread, timer, notifications, or something else?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread, timer, notifications, or something else?


  • Subject: Re: Thread, timer, notifications, or something else?
  • From: Eric Blom <email@hidden>
  • Date: Sun, 30 Mar 2003 22:48:17 -0800

Hello Oleg,
Thank you for your suggestion. I've added the two lines you suggested
to my code and everything appears to be OK. Now I just have to read up
on their documentation to find out what they do!

To answer your question I am updating the view in the following way.

First my document has an NSTextField.
IBOutlet NSTextField *statusField;

The document also has the following method:
- (void)setStatusFiled:(NSString *)fieldValue
{
[statusField setStringValue:fieldValue];
}

In my controller methods I use statements such as the following:
[currentDocument setStatusFiled:@"Programming verified."];

I don't believe I'm actively asking the view to update.

I'm very new to cocoa and object oriented programming so I'm sure I've
made more than a few mistakes. I appreciate your help with my previous
question and the other questions I have have found answers to through
this list. Some of them from searching the archives. ;-)

Cheers,
Eric


On Sunday, March 30, 2003, at 10:22 PM, Oleg Svirgstin wrote:

> Hi Eric,
>
> In your "programPart:" method you have to manually allocate and
> deallocate
> the autorelease pool.
>
> Like this:
>
> - (something) programPart: (id)anObject
> {
> NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
>
> //do your stuff
>
> [pool release];
> }
>
>
> Now about the "real-time" updates of the view:
> How do you "send the messages" and how do you ask the view to update?
>
> Regards
> Oleg
>
>
>> From: Eric Blom <email@hidden>
>> Date: Sun, 30 Mar 2003 19:21:57 -0800
>> To: email@hidden
>> Subject: Thread, timer, notifications, or something else?
>>
>> I'm working on a document based application that interfaces with a
>> piece of USB hardware. Some of the USB operations take several
>> seconds.
>> During long operations my controller is sending back status messages
>> to
>> be displayed in the documents view. My problem is that the document's
>> view is not updated (with the exception of the spinning progress
>> indicator) until the USB operation is complete.
>>
>> My assumption is that this is not a USB specific problem. Rather, the
>> problem is that the view is not getting any CPU time because the
>> application is single threaded and the controller method that
>> initiated
>> the long USB operation has not returned.
>>
>> I have two questions
>>
>> 1) If my characterization of the situation is correct do I need to
>> launch the USB operation in a separate thread, do I need to set up a
>> timer to update the view, or something else?
>>
>> I've tried the following but it failed with all kinds of leaking. See
>> end of email for errors.
>> [NSThread detachNewThreadSelector:@selector(programPart:)
>> toTarget:self
>> withObject:self];
>>
>> 2) Some of my USB operations involve polling the USB device to see if
>> it has completed its operation. I don't have control over the USB
>> devices firmware. What is the most CPU friendly way to poll the
>> device.
>> Currently I have while loop but I'm wondering if there is a better
>> way.
>>
>> Thanks for any suggestions you might have.
>>
>> Cheers,
>> Eric
>>
>>
>> Errors from [NSThread detachNewThreadSelector:@selector(programPart:)
>> toTarget:self withObject:self];
>>
>> 2003-03-30 19:05:38.872 MacPSoC Programmer[3612] ***
>> _NSAutoreleaseNoPool(): Object 0x129d070 of class NSCFString
>> autoreleased with no pool in place - just leaking
-----------------------------------------------------------------
Eric D. Blom
email@hidden

Be at war with your vices, at peace with your neighbors, and let
every New Year find you a better man. --Benjamin Franklin
-----------------------------------------------------------------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Thread, timer, notifications, or something else? (From: Oleg Svirgstin <email@hidden>)

  • Prev by Date: Re: Is there a ready chart plotting view?
  • Next by Date: Re: NSView setVisible: method -- NOT
  • Previous by thread: Re: Thread, timer, notifications, or something else?
  • Next by thread: Assignment Types and schemes saving
  • Index(es):
    • Date
    • Thread