• 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: Multithreading with DO and Notifications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multithreading with DO and Notifications


  • Subject: Re: Multithreading with DO and Notifications
  • From: Greg Hulands <email@hidden>
  • Date: Sat, 26 Apr 2003 19:47:44 +1000

Hi Drew,
Thanks for the reply. Below is the backtrace of each thread. In the
first one, see how it is trying to forward the message over a
connection. I assume that it thinks _frame is a proxy (but it is not).
I have absolutely no idea why this is happening. Do you have any clues?

Any help is greatly appreciated.

Regards,
Greg

Code:
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
if (_frame)
{
NSRect imageBounds = ImageBoundsForCell(cellFrame);
NSImage *thumbnail = [_frame colorCorrectedThumbnail]; //this
is where it has the stack below and just sits there doing nothing
NSMutableParagraphStyle *center = [[NSMutableParagraphStyle
alloc] init];
NSDictionary *textAttribs;
.....
}
(gdb) bt
#0 0x90073c48 in mach_msg_trap ()
#1 0x90005f90 in mach_msg ()
#2 0x901489f0 in CFRunLoopRunInMode ()
#3 0x90180f58 in CFRunLoopRunSpecific ()
#4 0x907edce4 in -[NSConnection sendInvocation:] ()
#5 0x907f10b4 in -[NSObject(NSForwardInvocation) forward::] ()
#6 0x9068c130 in _objc_msgForward ()
#7 0x90807e88 in -[NSDistantObject methodSignatureForSelector:] ()
#8 0x907f0f8c in -[NSObject(NSForwardInvocation) forward::] ()
#9 0x9068c130 in _objc_msgForward ()
#10 0x001a064c in -[DLSPrejudgeCell drawWithFrame:inView:]
(self=0x11d50f0, _cmd=0x906b2b5c, cellFrame={origin = {x = 0, y = 0},
size = {width = 300, height = 200}}, controlView=0x11d3d00) at
DLSPrejudgeControl.m:215/Users/ghulands/DLS/
#11 0x930cdca4 in -[NSMatrix drawRect:] ()
#12 0x930809ec in -[NSView _drawRect:clip:] ()
#13 0x93096a34 in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#14 0x93096bbc in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#15 0x93096bbc in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#16 0x930761e8 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] ()
#17 0x930765d0 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] ()
#18 0x930765d0 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] ()
#19 0x930765d0 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] ()
#20 0x930c8224 in -[NSFrameView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] ()
#21 0x930b2c14 in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:] ()
#22 0x930963f4 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
#23 0x930a5778 in -[NSView displayIfNeeded] ()
#24 0x930b5608 in -[NSWindow displayIfNeeded] ()
#25 0x930a03b0 in _handleWindowNeedsDisplay ()
#26 0x90148464 in CFRunLoopRunInMode ()
#27 0x901487d4 in CFRunLoopRunInMode ()
#28 0x90180f58 in CFRunLoopRunSpecific ()
#29 0x969a3b70 in GetEventClass ()
#30 0x969b3a78 in GetKeyboardFocus ()
#31 0x969dabbc in BlockUntilNextEventMatchingListInMode ()
#32 0x9308dedc in _DPSNextEvent ()
#33 0x930a0158 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#34 0x930b1d88 in -[NSApplication run] ()
#35 0x9315fc58 in NSApplicationMain ()
#36 0x00004370 in main (argc=1, argv=0xbffffc6c) at
main.m:13/Users/ghulands/DLSX/
#37 0x000040f4 in _start (argc=1, argv=0xbffffc6c, envp=0xbffffc74) at
/SourceCache/Csu/Csu-45/crt.c:267/SourceCache/Csu/Csu-45/
#38 0x00003f74 in start ()
(gdb)
#0 0x9003eaa8 in semaphore_wait_signal_trap ()
#1 0x9003e8c4 in pthread_cond_wait ()
#2 0x90824180 in -[NSConditionLock lockWhenCondition:] ()
#3 0x930819a0 in -[NSUIHeartBeat _heartBeatThread:] ()
#4 0x9081cd38 in forkThreadForFunction ()
#5 0x90020d48 in bootstrap_status ()
(gdb)
#0 0x900257ac in select ()
#1 0x90161830 in CFRunLoopAddTimer ()
#2 0x90020d48 in bootstrap_status ()
(gdb)

On Saturday, April 26, 2003, at 06:47 PM, Drew McCormack wrote:

> On Saturday, April 26, 2003, at 07:41 AM, Greg Hulands wrote:
>
>> In my application I detach a worker thread to import a heap of images.
>> It communicates with a model object via DO so it can update its status
>> of the percentage completed of the import. In the update progress
>> method it looks like this
>> - (void)inputCaptureCompletionChanged:(float)amount
>> {
>> _inputCaptureCompletion = amount;
>> [self didChange];
>> if ((int)amount == 1)
>> [[NSNotificationCenter defaultCenter]
>> postNotificationName:DLSOrderCompletedInputCaptureNotification
>>
>> object:self];
>> }
>> The problem occurs when the notification gets posted that because
>> NSNotificationCenter is syncro it then dispatches the notification
>> before the thread the called it has exited. I have searched mamasam
>> but
>> could not find a definitive solution. Does anyone have any suggestions
>> on how to solve this as I am architecturally going out of my mind. I
>> have tried making a timer fire to post the notification, but the same
>> thing still happens.
>>
>> Any help is greatly appreciated.
>>
> Hi Greg,
>
> I'm not quite sure what your problem is, but if I understand
> correctly, you want the notification to be received in the main
> thread, not the worker. Is that right?
> If that is it, why not put the postNotif... call alone in a private
> method, and use the NSObject method
>
> - performSelectorOnMainThread:withObject:waitUntilDone:
>
> to call the private method in the main thread.
> That is, something like this:
>
> - (void)inputCaptureCompletionChanged:(float)amount
> {
> _inputCaptureCompletion = amount;
> [self didChange];
> if ((int)amount == 1)
> [self performSelectorOnMainThread:@selector(_notifyOfCompletion)
> withObject:nil waitUntilDone:NO]; // Maybe you need YES instead of NO
> }
>
> -(void)_notifyOfCompletion {
> [[NSNotificationCenter defaultCenter]
> postNotificationName:DLSOrderCompletedInputCaptureNotification
> object:self];
> }
>
> Hope this helps,
> Drew
>
> ----------------------------------
> Dr. Drew McCormack
> Trade Strategist (www.trade-strategist.com)
> Stock Market strategy design platform for Mac OS X.
> _______________________________________________
> 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.

  • Follow-Ups:
    • Re: Multithreading with DO and Notifications
      • From: Drew McCormack <email@hidden>
References: 
 >Re: Multithreading with DO and Notifications (From: Drew McCormack <email@hidden>)

  • Prev by Date: Getting IPs of all the remote machines
  • Next by Date: Re: Rendezvou
  • Previous by thread: Re: Multithreading with DO and Notifications
  • Next by thread: Re: Multithreading with DO and Notifications
  • Index(es):
    • Date
    • Thread