# Io Reference

Core / Core / Coroutine

|  | Coroutine is an primitive for Io's lightweight cooperative C-stack based threads.
|  | backTraceString Returns a formatted callStack output along with exception info (if any). In case of CGI script, wraps output with <code> tag. callStack Returns a list of Call objects. currentCoroutine Returns currently running coroutine in Io state. debugWriteln See `Object debugWriteln`. exception Returns the current exception or nil if there is none. freeStack Frees all the internal data from the receiver's stack. Returns self. ignoredCoroutineMethodNames List of methods to ignore when building a `callStack`. implementation Returns coroutine implementation type: "fibers", "ucontext" or "setjmp" inException Set to true when processing an exception in the coroutine. ioStack Returns List of values on this coroutine's stack. isCurrent Returns true if the receiver is currently running coroutine. isYielding Returns true if the receiver is yielding (not paused or running). label A label slot useful for debugging purposes. main [Seems to be obsolete!] Executes runMessage, resumes parent coroutine. parentCoroutine Returns the parent coroutine this one was chained from or nil if it wasn't chained. When a Coroutine ends, it will attempt to resume it's parent. pause Removes current coroutine from the yieldingCoros queue and yields to another coro. `System exit` is executed if no coros left. You can resume a coroutine using either `resume` or `resumeLater` message. pauseCurrentAndResumeSelf Pauses current coroutine and yields to a receiver. raiseException Sets exception in the receiver and resumes parent coroutine. result The result set when the coroutine ends. resume Yields to the receiver. Runs the receiver if it is not running yet. Returns self. resumeLater Promotes receiver to the top of the yieldingCoros queue, but not yielding to it. When current coroutine yields, receiver will resume. resumeParentCoroutine Pauses current coroutine and resumes parent. run Runs receiver and returns self. runLocals The locals object in whose context the coroutine will send its run message. runMessage The message to send to the runTarget when the coroutine starts. runTarget The object which the coroutine will send a message to when it starts. setException setInException(aBool) Set the inException status. Returns self. setLabel(aLabel) Sets the comment label for the Coro. Return self. setMessageDebugging(aBoolean) Turns on message level debugging for this coro. When on, this coro will send a vmWillSendMessage message to the Debugger object before each message send and pause itself. See the Debugger object documentation for more information. setParentCoroutine(aCoro) Sets the parent coroutine. Returns self. setResult setRunLocals setRunMessage setRunTarget(anObject) setStackSize(aNumber) Sets the stack size in bytes to allocate for new Coros. Returns self. showStack Writes backTraceString to STDOUT. showYielding Prints a list of yielding coroutines to STDOUT. stackSize Stack size allocated for each new coroutine. Coroutines will automatically chain themselves as need if more stack space is required. typeId Returns _ string. yield Yields to another coroutine in the yieldingCoros queue. Does nothing if yieldingCoros is empty. yieldCurrentAndResumeSelf Yields to a receiver. yieldingCoros Reference to Scheduler yieldingCoros.