File MIES_ThreadsafeUtilities.ipf

TS Helper functions for threadsafe code and main/worker function interactions.

Functions

variable TS_GetNewestFromThreadQueue(variable tgID, string varName, variable timeout_default = defaultValue, variable timeout_tries = defaultValue)

Return the newest variable named varName from the thread queue.

Return NaN if the thread is not running anymore.

Throws away anything else in the datafolder from the thread queue.

wave TS_GetNewestFromThreadQueueMult(variable tgID, WaveText varNames, variable timeout_default = defaultValue, variable timeout_tries = defaultValue)

Return the newest variables from the thread queue.

The function returns if it received at least one variable from the thread queue. Return an invalid wave reference if the thread is not running anymore.

Throws away anything else in the datafolder from the thread queue.

variable TS_ThreadGroupGetVariable(variable tgID, string varName)

Return the variable named varName from the thread queue or NaN if there is none.

Throws away anything else in the datafolder from the thread queue.

variable TS_ThreadGroupPutVariable(variable tgID, string varName, variable varValue)

Push a single variable named varName with value varValue to the thread queue.

variable TS_ThreadGroupPutDFR(variable tgID, dfref dfr)

Push a datafolder to the thread queue.

Works on a duplicate of the input DF to remove all references. dfr can be a free DF

variable TS_ThreadGroupFinished(variable tgID)

Returns 1 if all worker threads have finished.

variable TS_StopThreadGroup(variable tgID)

Stop the given thread group.

Assumes that the running worker functions finish on getting the abort variable sent.

Variables

static const double TS_GET_REPEAT_TIMEOUT_IN_MS = 1
static const double TS_ERROR_INVALID_TGID = 980