New topic: IllegalLockingException
<http://forums.realsoftware.com/viewtopic.php?t=30722> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message lazydog Post subject: IllegalLockingExceptionPosted: Wed Oct 28, 2009 1:34 pm Joined: Thu Feb 21, 2008 7:25 am Posts: 14 Hi Hope somebody can help me with this because it's driving me up the wall! I am writing a simulation which takes some time to run. While it is running I wish to display the current best solution in a Canvas. The simulation is implemented as a class derived from Thread and the simulation runs as a do ... until loop in the Run event handler. In order to draw the current solution I have a Timer which when triggered fetches the current solution from the simulation and invalidates the canvas which displays the solution. Now, I have to be careful that when fetching the current solution (from within the timer event), the simulation doesn't update the solution. To solve this I use an instance of CriticalSection(), and placed enter() and leave() calls at suitable locations in the simulation and timer event code. Now the problem I'm getting is that within the simulation the call to leave() is generating an IllegalLockingException(). I have no idea why and I can't see any reason why it should. I can get round the problem by removing the calls to enter() and leave() from the timer event code, or alternatively if I comment out the time consuming parts of the simulation then the exception goes away. I'm not doing anything fancy in the simulation by the way, just some calculations. Does anyone know of any problems with CriticalSection(), or have any idea what I might be doing wrong. Are there restrictions to the code that can be placed between enter() and leave()? I can post some code if anyone wants to cast their eye over it. Many thanks b e n Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
