Thanks for your answer. It appears that this semaphore and additional function should be done for all interface calls... Have you considered fixing this apparent design issue in upp? Why we cannot have upp serialize (if it needs to) the gui calls transparently, so that there would be no limits for threads calling the gui?
Additional question. Suppose we have a kill button in the GUI. void Task::KillButton(). How to kill the thread in this function? We presume the thread is heavy and cannot ping asking the interface for ShouldWeCancelNow() frequently enough to be able to shutdown itself.