TsgcWebSocketServer_HTTPAPIMethods › UnShareList

UnShareList Method

Releases the shared (read-only) lock previously acquired by ShareList.

Syntax

public void UnShareList();

Remarks

UnShareList releases the shared SRW lock taken by ShareList so that other readers can finish and writers (new connections, disconnects, LockList) can acquire the exclusive lock again. Every call to ShareList must be paired with exactly one call to UnShareList; place the call in the finally branch of a try..finally block so the lock is released even when the reader code raises an exception. Calling UnShareList without an outstanding ShareList produces undefined behavior.

Example


TList oList = oServer.ShareList();
try {
  // read-only iteration
} finally {
  oServer.UnShareList();
}

Back to Methods