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); } } |
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 > > |
From: Panayotis K. <pan...@pa...> - 2011-07-01 20:55:11
|
On Jul 1, 2011, at 9:25 PM, Paul Poley wrote: > 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 Paul, This is also a question from my side. The reason this "x" appears at the end of the notifyAll in ObjC is because this piece of code is passed through the "trimmer" extension, which replaces everywhere the "__" characters to "x". Is there any reason that the name of the function should remain "notifyAll__" and not change to something different, but compatible across the whole code? Steven, if you just want a wuick hack to make things a bit more relaxed, edit xmlvm.properties file and set trimmer to false |
From: Paul P. <bay...@gm...> - 2011-07-01 21:03:36
|
Gotcha. Yeah, that's fine as long as it's trimming it everywhere. Paul On Fri, Jul 1, 2011 at 3:55 PM, Panayotis Katsaloulis < pan...@pa...> wrote: > > On Jul 1, 2011, at 9:25 PM, Paul Poley wrote: > > > 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 > > > > Paul, > This is also a question from my side. > The reason this "x" appears at the end of the notifyAll in ObjC is because > this piece of code is passed through the "trimmer" extension, which replaces > everywhere the "__" characters to "x". > Is there any reason that the name of the function should remain > "notifyAll__" and not change to something different, but compatible across > the whole code? > > > Steven, > if you just want a wuick hack to make things a bit more relaxed, edit > xmlvm.properties file and set trimmer to false > > ------------------------------------------------------------------------------ > 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 > |
From: Panayotis K. <pan...@pa...> - 2011-07-01 21:30:01
|
On Jul 2, 2011, at 12:03 AM, Paul Poley wrote: > Gotcha. Yeah, that's fine as long as it's trimming it everywhere. > > Paul Strangely, I have the same issues with Steven when I enable the trimmer (although the change is everywhere in the code). I have seen that if trimmer is enabled, the code breaks with the specific error message, while when it is disabled it works. I didn't investigate much, since I am looking forward for the C backend now, but this is something that bothered me. |