SM.Read

Previous  Next

 

value = SM.Read( hHandle AS HANDLE, variable-name AS STRING, vartype AS TYPE, wait AS INTEGER ) AS VARIANT

result = SM.Read( hHandle AS HANDLE, BYREF array AS REAL, wait AS INTEGER ) AS INTEGER

 


 

Read the value of a variable from the shared memory pool.  If the wait parameter is TRUE, then read will wait until another thread or process has written to the variable enable this to be used to synchronize 2 threads or processes.  The vartype parameter sepcified the variable data type and the result variable must be of this type.

 

The second format will read from the shared memory pool into the array passed as a reference.  Result > 0 if success.

 

Example:

 

DIM handle AS INTEGER

DIM did_it AS INTEGER

 

' Open the shared memory pool called "big_pool"

handle = SM.Open( "big_pool" )

 

' Read from INTEGER variable Nils.  Wait until written

did_it = SM.Read( handle, "Nils", INTEGER, TRUE )

 

' Close pool

SM.Close( handle )

 

''''''''''''''''''''''''''''''''''''''''''''''''''''

' Second format

 

DIM arr( 10 ) AS REAL

SM.Read( handle, REF( arr ) )