JagIsRollbackOnly  JagLockNoWaitCollection

Chapter 5: C Routines Reference

JagLockCollection

Description

Lock a collection.

Syntax

JagStatus JagLockCollection (
            JagDataCollection * pCollection)

Parameters

pCollection

The handle of the collection.

Returns

Return value

To indicate

JAG_SUCCEED

Success

JAG_FAIL

Failure

JagLockCollection fails if the collection’s isolation mode is JAG_LOCKDATA.

Check the server’s log file for more information when JagLockCollection fails.

Usage

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, JagLockCollection waits until the lock is released. 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 JagLockCollection 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 calling object, this method does not lock the collection and JAG_SUCCEED is returned.

See Appendix C, “Creating C Components,” in the EAServer Programmer’s Guide for more information.

See also

JagGetSharedValue, JagLockNoWaitCollection, JagSetSharedValue, JagUnlockCollection





Copyright © 2005. Sybase Inc. All rights reserved. JagLockNoWaitCollection