thread.getGlobalAddress

Syntax thread.getGlobalAddress (name)

Params name is the name of a variable that's global to your thread. It may or may not already exist.

Action Get the address of the global variable.

Returns An address.

Examples thread.getGlobalAddress ("myGlobal") //get the address of a thread global

   » @_myGlobal_

thread.getGlobalAddress ("myGlobal")^ = clock.now () //create and/or set the value of a thread global

   » "7/2/01; 2:21:43 PM"

Notes Sometimes you want to write code that has pagetable-like behavior, but you're not running in a website framework context. You can create a thread-specific global table or other global variables using this verb, and scripts that get called during the execution of the thread can reference these thread globals.

About scope: if script abc sets a global using this verb, then abc calls script def -- def can get and set that global via this verb. However, if def creates a global, then returns control to abc, the global will no longer exist, so abc will not be able to reference it.

This verb builds on a little-known feature of Frontier, that variables with names that start and end with an underscore (_) are global to the thread. However, counting on this behavior is not recommended -- which is why this verb exists. (So we can change the underlying implementation without changing the API.)

This verb is new in Frontier 7.1.

See Also html.getPageTableAddress

thread.getCurrentID

Discuss