Class threads.thread.attr

Get and set lua threads attribute values

Functions

detachstate ( lto, bool ) Get or set a lua threads detachstate attribute
scope ( lto, scope ) Get or set a lua thread objects scope attribute
inheritsched ( lto, sched ) Get or set a lua thread objects inheritschedule attribute
schedparam ( lto, param ) Get or set a lua thread objects schedparam attribute
stacksize ( lto, stacksize) Get or set a lua thread objects stacksize attribute
stackaddr (lto) Get a lua thread objects stackaddr (memory location)
datacopy ( lto, bool ) Print a lua thread objects attributes to stdout


Functions

detachstate ( lto, bool)
Get or set a lua thread objects detachstate attribue

Parameters

  • lto: Lua thread object
  • bool: detached state (optional)
    available options: true | false

Return value:

string representing a lua thread objects detached state attribute value.
possible values: PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED
scope ( lto, scope )
Get or set a lua thread objects scope atrribute

Parameters

  • lto: Lua thread object
  • scope: String value to set scope attribue option (optional)
    avaiable options: "explicit" | "inherit"

Usage:

Note:

This function has no effect on linux OS, linux allows only PTHREAD_SCOPE_SYSTEM which is the default value.

Return value:

string representing a lua threads scope attribute value.
possible values: PTHREAD_SCOPE_SYSTEM | PTHREAD_SCOPE_PROCESS
inheritsched ( lto, sched )
Get or set a lua thread objects inheritsched attribute

Parameters

  • lto: Lua thread object
  • sched: String value to set inheritsched attribue option (optional)
    avaiable options: "explicit" | "inherit"

Usage

Return value:

string representing a lua threads schedule inherit attribute value.
possible values: PTHREAD_EXPLICIT_SCHED | PTHREAD_EXPLICIT_INHERIT

See also:

schedparam ( lto, param )
Get or set a lua thread objects schedparam attribute

Parameters

  • lto: Lua thread object
  • param: Integer value to set lua threads schedparam (priority) attribue option (optional)

Return value:

Integer value representing the lua threads objects schedparam (priority).
stacksize ( lto, stacksize)
Get or set a lua thread objects stacksize attribute

Parameters

  • lto: Lua thread object
  • stacksize: integer value representing stacksize in bytes. (optional)

Usage:

local ret, stacksize = thread.attr.stacksize(lto);

if(ret == 0 ) then
  print(stacksize.." bytes")
end

local new_stacksize = 16384;

ret, new_stacksize = thread.attr.stacksize(lto, new_stacksize)

Return values:

Return 2 vaules, the return value of the function call 0 or 1, and the stack size in bytes, if the call succeeds.
stackaddr ( lto )
Get a lua thread objects stackaddr (memory location).

Parameters

  • lto: Lua thread object

Usage:

The destination must always be a full destination path e.g. do not omit the basename even if source and destination basename are equal.

Return values:

Return 2 vaules, the return value of the function call 0 or 1, and the stackaddr memory location, if the call succeeds.
show ( lto, bool )
Print a lua thread objects attributes to stdout

Parameters

  • lto: Lua thread object

Return value:

No values returned

Valid XHTML 1.0!