• 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: beginSheet, doesn't stop NSThread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: beginSheet, doesn't stop NSThread


  • Subject: Re: beginSheet, doesn't stop NSThread
  • From: Manfred Schwind <email@hidden>
  • Date: Fri, 20 Jul 2007 16:25:39 +0200

very intersting, however it doesn't seem to make it. As i start my thread I've inserted:

[self performSelectorOnMainThread:@selector(displayDialog:) withObject:nil waitUntilDone:YES];

The dialog window is:

	NSOpenPanel *open = [NSOpenPanel openPanel];
	[open setCanChooseFiles:NO];
	[open setCanChooseDirectories:YES];
	[open setAllowsMultipleSelection:NO];
	[open beginSheetForDirectory:NSHomeDirectory()
							file:nil
				  modalForWindow:theWindow
				   modalDelegate:self
				  didEndSelector:@selector(didEndSaveSheet:returnCode:conextInfo:)
					 contextInfo:NULL];


But the thread doesn't stop. Maybe it's at the dialog level where it should halt and continue only until it is closed... dunno...


What am I doing wrong?

That's what Chris said.
You are using a sheet and this is asynchronous. So you function "displayDialog" is returning from the main thread, but the sheet is still open. But because the displayDialog method returns, the thread continues to run.


So you have to synchronize your two threads somehow - e.g. through locking. An NSConditionLock may be the best choice here.

Your thread should wait for a specific condition on that lock and the main thread should set that condition when the didEndSaveSheet:returnCode:conextInfo: is called.

Regards,
Mani

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >beginSheet, doesn't stop NSThread (From: Micha Fuhrmann <email@hidden>)
 >Re: beginSheet, doesn't stop NSThread (From: Manfred Schwind <email@hidden>)

  • Prev by Date: Re: Newbie Question: Why would my App freeze when I select a rowinan NSTableView? - Found word(s) Re: in the subject - Email has different SMTP TO: and MIME TO: fields in the email addresses
  • Next by Date: Re: NSArrayController content array vs arrangedObjects
  • Previous by thread: Re: beginSheet, doesn't stop NSThread
  • Next by thread: Re: beginSheet, doesn't stop NSThread
  • Index(es):
    • Date
    • Thread