.. include:: ../global.rst Thread State ^^^^^^^^^^^^ An :lname:`Idio` *thread* holds various elements of state about a thread of execution. From a user's perspective it maintains the concepts of the current input, output and error handles and the current module. Thread Accessors """""""""""""""" .. _`current-error-handle`: .. idio:function:: current-error-handle Return the current error handle :return: current error handle :rtype: handle .. _`current-input-handle`: .. idio:function:: current-input-handle Return the current input handle :return: current input handle :rtype: handle .. _`current-output-handle`: .. idio:function:: current-output-handle Return the current output handle :return: current output handle :rtype: handle .. _`set-input-handle!`: .. idio:function:: set-input-handle! handle Set the current input handle to `handle` :param handle: handle to use :type handle: handle :return: ``#`` .. _`set-output-handle!`: .. idio:function:: set-output-handle! handle Set the current output handle to `handle` :param handle: handle to use :type handle: handle :return: ``#`` .. _`set-error-handle!`: .. idio:function:: set-error-handle! handle Set the current error handle to `handle` :param handle: handle to use :type handle: handle :return: ``#`` .. _`current-module`: .. idio:function:: current-module Return the current module :return: current module :rtype: module .. _`idio-thread-state`: .. idio:function:: idio-thread-state [args] Display a dump of the current thread's state :return: ``#`` .. _`run-in-thread`: .. idio:function:: run-in-thread thr thunk Run `thunk` in thread `thr`. :param thr: the thread :type thr: thread :param thunk: a thunk :type thunk: function .. _`%%vm-trace`: .. idio:function:: %%vm-trace level [file [mode]] set VM tracing to `level` for user code :param level: new VM tracing level :type level: fixnum :param file: new VM tracing file, defaults to ``#n`` :type file: string, FD handle or ``#n``, optional :param mode: file mode, defaults to ``"w"`` :type mode: string, optional :return: ``#`` .. _`%%idio-dasm`: .. idio:function:: %%idio-dasm [c] generate the disassembler code for closure `c` or everything :param c: (optional) the closure to disassemble :type c: closure The output goes to the file(s) :file:`idio-vm-dasm.{n}` in the current directory. These may get overwritten when Idio stops. .. _`%vm-call-tree`: .. idio:function:: %vm-call-tree [args] Show the current call tree. :param args: (optional) :type args: list .. _`%vm-decode-stack`: .. idio:function:: %vm-decode-stack Decode the current stack. .. _`%vm-tables`: .. idio:function:: %vm-tables Dump the VM's tables. .. _`%vm-frame-tree`: .. idio:function:: %vm-frame-tree [args] Show the current frame tree. :param args: (optional) :type args: list .. _`%vm-trap-state`: .. idio:function:: %vm-trap-state Show the current trap tree. .. include:: ../commit.rst