From: Paul P. <bay...@gm...> - 2011-07-01 18:25:17
|
I don't see all the relevant snippets, but believe I know what's happening, and this is expected behavior. The short of it is that when you call "obj.notifyAll()", you should already be synchronized on "obj", which it appears you are not. This is true in Java as well as XMLVM, whether using the C or Obj-C version. Note that I am saying that "notifyAll" needs to be synchronized, but so does the "wait". Your stacktrace says "notifyAllx", which I assume should be "notifyAll". You are using the Obj-C backend, so that has been the case for a while. The wait, notify, etc. for the C backend has only recently been implemented. Thanks, Paul On Fri, Jul 1, 2011 at 5:38 AM, Steven Atkinson <ste...@gm...>wrote: > 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); > } > } > > > > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > xmlvm-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > > |