• 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
confusing events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

confusing events


  • Subject: confusing events
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Mon, 10 Sep 2007 14:59:13 +0200

I have a class

@interface MyClass : NSObject  <My_Protocol>
@end

@implementation MyClass
-(void)main;
{
	NSLog(@"%s start",__FUNCTION__);
	//	do something mainly
	NSLog(@"%s end",__FUNCTION__);
}

-(oneway void)process
{
	NSLog(@"%s",__FUNCTION__);
	// do some processing
}
@end

MyClass lives in the main thread and gets process-messages via Distributed Objects (NSConnection) from a worker thread.

Sometimes I see:

-[MyClass main] start
	-[MyClass process]
-[MyClass main] end

That is:
- some event starts the main method (actually it is [myClass performSelector: @selector(main) withObject: nil afterDelay: 0.0 ]),
- then the execution is interrupted and switched to the process method,
- then main resumes and runs until its end.


All run in the same thread (I did log [NSThread currentThread]).
I think this, i.e. the fact that the method triggered by an event does NOT run to its end, but gets interruped by another method (in the same thread), extremely confusing.
Could someone point to some helpful documentation ?


Kind regards,

Gerriet.

P.S. My current work-around is:

-(oneway void)process
{
[self performSelector: @selector(realProcess) withObject: nil afterDelay: 0.0 ];
}


-(void)realProcess
{
	NSLog(@"%s",__FUNCTION__);
	// do some processing
}

Now realProcess and main are no longer interleaved and all is fine.

_______________________________________________

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


  • Follow-Ups:
    • Re: confusing events
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: Changing button size programmatically
  • Next by Date: Re: RS: Reply about NSObject members class, isMemberOfClass, isKindOfClass
  • Previous by thread: Re: Dragging to reorder rows in table not working
  • Next by thread: Re: confusing events
  • Index(es):
    • Date
    • Thread