File MIES_ThreadsafeDataSharing.ipf

Helper functions for accessing global objects from all threads.

Functions

static wave TSDS_Create(string name)

Creates/Overwrites a threadstorage and returns it.

static variable TSDS_CreateVar(string name, variable var)

Creates/Overwrites a threadstorage and puts a numerical value in.

variable TSDS_ReadVar(string name, variable defValue = defaultValue, variable create = defaultValue)

Reads a numerical value from a threadstorage.

Parameters:
  • name – name of threadstorage

  • defValue – [optional: default NaN] default value used when storage is created, create flag must be set

  • create – [optional: default 0] when set the threadstorage is created if it did not exist or had an incompatible format, defValue must be given

variable TSDS_WriteVar(string name, variable var)

Writes a numerical value to a threadstorage, if the threadstorage does not exist it is automatically created.

Parameters:
  • name – name of threadstorage

  • var – numerical value that should be written

static variable TSDS_CreateWave(string name, WaveOrNull wv)

Creates/Overwrites a threadstorage and puts a wave into it.

wave TSDS_ReadWave(string name, WaveOrNull defWave = defaultValue, variable create = defaultValue)

Reads a wave from a threadstorage.

Parameters:
  • name – name of threadstorage

  • defWave – [optional: defaults to $””] default value used when storage is created, create flag must be set

  • create – [optional: default 0] when set the threadstorage is created if it did not exist or had an incompatible format, defValue must be given

variable TSDS_WriteWave(string name, WaveOrNull wv)

Writes a wave to a threadstorage, if the threadstorage does not exist it is automatically created.

The wave is not duplicated, so when reading it back it is the same wave reference as what was put in.

Parameters:
  • name – name of threadstorage

  • wv – numerical value that should be written

static wave TSDS_Read(string name)

Reads a single wave ref wave from a named threadstorage.