From: Steven A. <ste...@gm...> - 2011-07-01 10:39:06
|
Hi, I am getting an error when my a function in another thread finishes. Here is the message that appears in the log window. 2011-07-01 11:29:40.230 ThreadingTest[12323:7703] *** Terminating app due to uncaught exception 'MyIllegalMonitorStateException', reason: '(null)' *** Call stack at first throw: ( 0 CoreFoundation 0x019995a9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x01aed313 objc_exception_throw + 44 2 TetradProductList 0x0002a31e -[NSObject(cat_MyObject) checkSynchronized] + 301 3 TetradProductList 0x0002b034 -[NSObject(cat_MyObject) notifyAllx] + 37 4 TetradProductList 0x0002e119 -[MyThread threadCallback:] + 262 5 Foundation 0x000f4cf4 -[NSThread main] + 81 6 Foundation 0x000f4c80 __NSThread__main__ + 1387 7 libSystem.B.dylib 0x983c4819 _pthread_start + 345 8 libSystem.B.dylib 0x983c469e thread_start + 34 ) terminate called after throwing an instance of 'MyIllegalMonitorStateException' I recall a previous post where Paul said he had done some work on some of the threading functions (sleep(), wait() etc.) Is there anything I should be doing at the end of the function to remove the thread? @Override public void viewDidLoad() { super.viewDidLoad(); ShowSynchronizeAlert(); } public void ShowSynchronizeAlert(){ try { UIAlertView av = new UIAlertView("Attention", "Do you want to synchronize?", new UIAlertViewDelegate() { @Override public void clickedButtonAtIndex(UIAlertView uiav, int i) { switch(i) { case 0: try { Thread t = new Thread(new Runnable() { public void run() { try { Synchronize(); } catch(Exception e) { Logging.Error(e); } } }); t.start(); } catch(Exception e) { Logging.Error(e); } break; case 1: // Do nothing break; } } }, "OK"); av.addButtonWithTitle("No"); av.show(); } catch(Exception e) { Logging.Error(e); } } |