NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

SyncLock Statement

Allows statements to be synchronized on a single expression.

SyncLock expression
...[Block]
End SyncLock

Parameters

expression
Required. A unique collection of operators and values that yield a single result.

Remarks

The SyncLock statement ensures that multiple threads do not execute the same statements at the same time. When the thread reaches the SyncLock block, it evaluates the expression and maintains this exclusivity until it has an lock on the object that is returned by the expression. This prevents an expression from changing values during the running of several threads, which can give unexpected results from your code.

Note    The type of the expression in a SyncLock statement must be a reference type, such as a class, a module, an interface, an array or a delegate.

See Also