From: Jeffrey on
Hi All,

I've got a Simulink model that has a Level 2 M-file S-function that calls a nested GUI function at every update step. The point of course being to update the GUI at every step of the simulation.

Here's the issue: Simulink runs in a seperate thread than the GUI. If I call a callback (push a button for instance) in the GUI, and the callback takes a significant amount of time, then the callback gets interrupted by the 'update' call from Simulink. This can lead to some nasty bugs as you can imagine.

I tried getting around this by creating my own mutex-like library, but the problem I'm running into is that if the 'update' call from Simulink comes in in the middle of a callback, the callback doesn't continue to process until the 'update' call is done. Thus, when the update function tries to grab the mutex lock, the locking function timeouts since the callback won't continue and release the lock. Here it seems like the Simulink and GUI threads merged, but is that what really is happening?

Does anyone have a clear idea of how Simulink/Matlab GUI threads work together? If it helps, I'm exclusively using nested functions for my GUI callbacks.

Thanks!
Jeff
 | 
Pages: 1
Prev: print flag -r864
Next: running out of memory