Concurrency ?

Former Member
Former Member
Can someone from the Connect IQ team elaborate a bit about concurrency? There's nothing about this in any documentation, there nothing like locking mechanisms etc., in the framework and I'd like to know what behavior I might expect.
For instance:
- in a data field could there be a context switch half way in executing the compute function and could onUpdate then be called on a different thread, resulting in unexpected behavior when reading from/writing to an object or array?
- If I have something executing for a while in a widget, should I display a wait screen, because the screen will be irresponsive anyway?
- Is there difference between different devices or between devices and the simulator?
  • Former Member
    Former Member over 10 years ago
    At this time, all Monkey C code runs on a single thread. It is not possible to be switched away from the compute function part of the way through.

    If you are doing extended computation, you could utilize the native Progress Bar class to display progress or a wait screen. If you are doing extended computation, you will need to break your computation into iterations in some way, because you have to return from Monkey C code to allow the progress bar to update.
    You also must break your computation up because Monkey C callbacks are limited by a watchdog. Executing for longer than ~5 seconds will cause your app to crash with a watchdog error. (Note, this is not tuned properly in version 1.0.0, so you may only be able to trip it with an infinite loop until we get the next release out.)

    All devices and the simulator should share this behavior. The simulator will probably trip the watchdog much faster because it executes much faster than the devices.
  • Former Member
    Former Member over 10 years ago
    Thanks.