Class threads

Library for viewing Lua Thread Stats.

Functions

stats () Print Lua Threads Stats to stdout.
completed () Returns the number of completed threads.
yielded () Returns the number of yielded threads.
active () Returns the number of active threads.
errored () Returns the number of errored threads.


Functions

stats ()
Print all current threads stats to stdout.

Usage:

threads.stats()
completed ()
Return the number of threads completed (status: OK).

Usage:

while( threads.complete() < num_threads ) do
    ...
end

Return value:

a non negative number value, representing threads completed at the time of the call
yielded ()
Return the number of threads in yielded state (status: SUSPENDED).

Usage:

if( threads.yielded() > 0 ) then
    ...
end

Return value:

a non negative number value, representing threads yeilded at the time of the call

Demo:

See also:

active ()
Return the number of threads in active state (status: WORKING).
Notice: active does not count yielded threads

Usage:

while( threads.active > 0 ) do
    wait ...
end

Return value:

a non negative number value, representing threads active at the time of the call

See also:

errored ()
Return the number of threads in active state (status: WORKING).

Usage:

if( threads.errored > 0 ) then
    investigate ...
end

Return value:

a non negative number value, representing threads that errored before completion (status: ERRORED).

Valid XHTML 1.0!