up: THREAD     index Zimbu documentation

CLASS T.evalThread<Titem> EXTENDS THREAD.ThreadBase @public

summary

     

Thread to be used for evaluating a function and returning the result through a pipe.

Titem is the type of the item returned through the pipe.

Example: evaluate an expression in a thread:

 pipe<string> p = T.evalThread<string>.NEW().eval({ => "hello there" })
 IO.print(p.read())

NEW(f) @public 
$setProc(f) @public  Set the function to be invoked by start().
$eval(f) pipe<Titem> @public  Start the thread and return the pipe to read the result from.
$getPipe() pipe<Titem> @public  Return the pipe to read the result from.
 
eval(f) pipe<Titem> @public  Quick way to evaluate a function in a thread.
 
Inherited from THREAD.ThreadBase:
string  $name @public  optional name, NIL when not set
THREAD.State  $state @public  state of the thread
Type  $type @public  type of thread
int  $ctxLen @file 
 
NEW() @public  Create a new thread.
$setName(name) ThreadBase @file  Set the name of the thread.
$start() ThreadBase @public  Start executing the thread.
$wait() @public  Wait in the current thread for the thread of this object to finish.
$kill() @public  Kill the thread, stop its execution.
$remove() @public  Not Implemented Yet
 

members (alphabetically)

     

PROC NEW(func< => Titem> f) @public

FUNC $eval(func< => Titem> f) pipe<Titem> @public

     

Start the thread and return the pipe to read the result from.

FUNC $getPipe() pipe<Titem> @public

     

Return the pipe to read the result from.

read() on this pipe will only work once.

PROC $setProc(func< => Titem> f) @public

     

Set the function to be invoked by start().

TODO: return the object.

shared (alphabetically)

     

FUNC eval(func< => Titem> f) pipe<Titem> @public

     

Quick way to evaluate a function in a thread.

Equivalent to T.evalThread<Titem>.NEW().eval(f)

license

      Copyright 2009 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0