| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== THREADLOCKED (returns current execution thread locked state) ====== | [[thread return current execution thread .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[tie associate a string value to an astring .htm|{{btn_next_n.gif|Next page}}]] | | || **THREADLOCKED()** {{blk2blue.jpg|blk2blue.jpg}} The **THREADLOCKED** procedure returns the current execution thread's locked/unlocked state. It returns zero (0) if the thread is unlocked and one (1) if the thread is locked. **Return Data Type:     **SIGNED **Example:** ** X# = ****THREADLOCKED****()             !Returns 1** ** UNLOCKTHREAD                    !Unlock the thread** ** X# = ****THREADLOCKED****()             !Returns 0** ** MyLibraryCodeWithMessageLoop    !Call the code that has its own message loop** ** LOCKTHREAD                      !Re-lock the thread** **See Also:** [[accept the event processor .htm|ACCEPT]] [[lockthread re lock the current execution thread .htm|LOCKTHREAD]] [[unlockthread unlock the current execution thread .htm|UNLOCKTHREAD]]