Re: Thread, timer, notifications, or something else?
Re: Thread, timer, notifications, or something else?
- Subject: Re: Thread, timer, notifications, or something else?
- From: Oleg Svirgstin <email@hidden>
- Date: Mon, 31 Mar 2003 09:22:14 +0300
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
>
2003-03-30 19:05:38.873 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x127dff0 of class NSConcreteValue
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.873 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x1320020 of class NSCFDictionary
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.881 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x132ce90 of class NSCFString
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.882 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x1338e00 of class NSConcreteValue
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.882 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x12972f0 of class NSCFDictionary
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.908 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x131d080 of class NSCFString
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.909 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x131d0a0 of class NSConcreteValue
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.912 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x12949f0 of class NSCFDictionary
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.952 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x131fbb0 of class NSCFString
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.953 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x14e9680 of class NSConcreteValue
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:38.953 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x14e9700 of class NSCFDictionary
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:46.994 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x12949d0 of class NSCFString
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:46.995 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0xbbfe0 of class NSConcreteValue
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:46.996 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x14eaea0 of class NSCFDictionary
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:53.772 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x130a0b0 of class NSCFString
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:53.773 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x1280ff0 of class NSConcreteValue
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:53.774 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x1309520 of class NSCFDictionary
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:55.806 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x1300480 of class NSCFString
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:55.807 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x130e130 of class NSConcreteValue
>
autoreleased with no pool in place - just leaking
>
2003-03-30 19:05:55.807 MacPSoC Programmer[3612] ***
>
_NSAutoreleaseNoPool(): Object 0x1278480 of class NSCFDictionary
>
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.
_______________________________________________
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.