.. highlightlang:: us .. _us_lock: us_lock ======= .. index:: us_lock .. us.tag us_lock NOTREADYENGLISH ProgMisc New5145 :ref:`us_lock` locks the Windows message loop while an UniScript function is executed. .. function:: old_lock = us_lock(bLock) .. us.return **Return Value** *old_lock* is the value of the lock flag before the function call. .. us.params **Parameters** .. uparam:: bLock If *bLock* is TRUE (1) the message loop is locked and if *bLock* is FALSE (0) the message loop is unlocked. .. us.comment **Comment** If the lock flag is enabled, the execution of a UniScript function cannot be aborted (via ESC key or Ctrl+C). Paint messages are not executed, the UniPlot window is not updated. It is also not possible to start another UniScript command. If the lock flag is not set to ``us_lock(FALSE)`` 5 seconds after ``us_lock(TRUE)`` has been called it will be set to FALSE automatically. The following while loop cannot be interrupted for 5 seconds (Ctrl+C or ESC). :: { us_lock(1); while (1) a=1; } .. us.example **Example** :: old = us_lock(TRUE); // Do something us_lock(old); .. us.history .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - 5.14.5 - New. .. seealso:: :ref:`overview-programming` :sub:`id-47519`