Chapter 5 C Routines Reference
Lock a collection but do not wait for a locked collection to be unlocked.
JagStatus JagLockCollection (
JagDataCollection * pCollection,
JagBoolean * pLocked)
pCollection
The handle of the collection.
pLocked
The address of a JagBoolean variable that will be set to indicate the lock status, as follows:
Value |
To indicate |
---|---|
JAG_TRUE |
The collection was not locked or the collection was already locked by the same calling object |
JAG_FALSE |
The collection was locked by another object |
Return value |
To indicate |
---|---|
JAG_SUCCEED |
Success, even if the collection was locked by another object |
JAG_FAIL |
Failure |
JagLockNoWaitCollection fails for the following reason:
Check the server's log file for more information when JagLockNoWaitCollection fails.
Locking a collection is strictly advisory. Even though a collection is locked, the JagGetSharedValue and JagSetSharedValue methods can still read and update the shared variables in the collection. If the collection is locked, JagLockNoWaitCollection does not wait until the lock is released and execution immediately returns to the calling method. To ensure that multiple read and update operations on any shared variable in a collection is atomic, lock the collection before executing read or update operations on the shared variables in the collection.
The JagLockNoWaitCollection method prevents other JagLockCollection and JagLockNoWaitCollection requests from locking the collection until the lock is released. If the lock is successful, JAG_SUCCEED is returned. If the collection has already been locked by the same calling object, this method does not lock the collection and JAG_SUCCEED is returned.
See "Share Data Between C Components" in the Jaguar CTS Programmer's Guide for more information.
JagGetSharedValue, JagLockCollection, JagSetSharedValue, JagUnlockCollection
Copyright © 2000 Sybase, Inc. All rights reserved. |
![]() |