* I think that it is quite error-prone to run several threads in single instance. Chances that you make unserialized access to some member variable are high
* However, the more serious problem is with application exit. When you press Close button, chances are that thread will be running and will invoke dangling callback.
I have tried to fix both and to improve the example (using uint64 etc...) - it is now in "reference".