• 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
oneway void causing deadlock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

oneway void causing deadlock


  • Subject: oneway void causing deadlock
  • From: Aram Greenman <email@hidden>
  • Date: Mon, 17 Jun 2002 21:26:52 -0700

Here is the problem:

Several workers each run in their own thread, each connected to the boss by an NSConnection. The main function of the workers is to listen for data from the network and forward it to the boss with -[Boss receivedData:fromWorker:]

- (void)receivedData:(bycopy Data *)d fromWorker:(byref Worker *)w;

currently this method is a no-op.

A worker continues to loop on this method until the boss sets an abort flag, or an exception is raised, which causes the worker to set its own abort flag.


while (!abort) {
NS_DURING {
[boss receivedData:[self getData] fromWorker:self];
} NS_HANDLER {
[self abort]; // sets abort = YES
} NS_ENDHANDLER;
}


OK, this works, but I don't want my worker threads wasting time waiting for the boss to process the data so I changed the return value of -[Boss receivedData:fromWorker:] from 'void' to 'oneway void'.

Now the first time an exception is raised in any worker thread I get deadlock. The top of every thread's stack frame is a mach_msg_overwrite_trap. The thread which raised the exception is stuck in -[NSThread _exit].

I must be missing something, right? If this post is not detailed enough let me know, I tried to strip it down to the simplest possible example.

aram
_______________________________________________
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.

  • Prev by Date: Re: Drag and drop to an application icon
  • Next by Date: Re: Webdings et.al. ?
  • Previous by thread: NSOpenGLView's initWithFrame: argument
  • Next by thread: Getting a list of installed applications
  • Index(es):
    • Date
    • Thread