| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== SUSPEND (suspend thread execution) ====== | [[sub return substring of string .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[tan return tangent .htm|{{btn_next_n.gif|Next page}}]] | | || **SUSPEND(**//threadno//**, **//quietmode//**)** {{blk2blue.jpg|blk2blue.jpg}} | **SUSPEND** | Suspend thread execution. | | //threadno// | A numeric constant, variable, or expression that can be evaluated as a SIGNED integer. | | //quietmode// | A numeric constant, variable, or expression that can be evaluated as a SIGNED integer. | The **SUSPEND** function suspends a thread specified by the //threadno// parameter. If the //threadno// parameter is a number of an active thread, its execution is suspended and a suspending counter is incremented. Each additional **SUSPEND** statement issued to the same active thread will increment the suspending counter by one. Therefore, a thread that has been suspended with a given number of **SUSPEND** statements can only resume thread execution when an equal number of RESUME statements has been executed. The //quietmode// parameter controls the built-in messaging support provided by **SUSPEND**. If the //quietmode// parameter is set to TRUE (1), SUSPEND will not display a message if it has detected that the thread it is about to suspend is not safe. If the //quietmode// parameter is set to FALSE (0), a message will be displayed if the impending thread suspension is not safe. SUSPEND returns TRUE (1) if a thread has been suspended and returns FALSE (0) if the thread could not be suspended. Care should be taken with MDI programs using **SUSPEND**, as improper use can cause program lockups. All MDI child windows have an MDI client window as a parent, and the MDI client window can send rather than post messages to its child windows. For example, calling the inter-thread SendMessage modal function (Windows API call) causes the calling thread (the MDI client window) to suspend activity until the called thread (the MDI Child window) returns from the call. If the called thread is suspended, we would have a program lockup. Suspending a thread that is not already active is ignored. **Return Data Type:     **SIGNED **Example:** **!suspend thread execution number stored in variable** **!Disable built-in messaging, use the one on next line** **IF NOT ****SUSPEND****(ThreadNumVariable,1)** **MESSAGE('Thread could not be suspended')** **END** **See Also:** [[resume resume thread execution .htm|RESUME]] [[launching a thread behind the scenes.htm|Launching a thread - behind the scenes]]