zBeginXaction

Begins a transaction.

Service:File System Services (64-Bit)

Syntax

#include <zPublics.h>

STATUS zBeginXaction(
   Key_t   key,
   NINT    taskID,
   Xid_t   parentXid,
   Xid_t  *retXid);

Parameters

key

(IN) Specifies the owner or key of the new transaction. We suggest that you use the same key to begin transactions and to commit or abort the transaction.

taskID

(IN) Specifies the transaction to bind the task to. If the task is released, all uncommitted transactions bound to the task are aborted.

parentXid

(IN) Specifies the parent ID. If set to zNILXID, a completely new transaction is started. However, if set to a transaction, that transaction becomes the parent to the new nested child transaction. When the child transaction commits, all of its locks are given to the parent transaction.

retXid

(OUT) Points to a transaction ID, which is passed to any operations that need to participate in the transaction. All operations that are bound to the transaction are processed as a group, either all complete or none complete.

Return Values

zOK

The operation completed successfully.

non-0

An error occurred (see Section 4.1, Return Values for a description).

Remarks

A transaction lets a set of operations be treated as a single atomic operation where either all of them are completed or none of them are completed.

A parent transaction cannot commit until all of its children and their descendants have committed. If a parent aborts, all of its children are aborted.

See Also

zAbortXaction, zCommitXaction, zLockByteRange, zPrepareToCommitXaction, zUnlockByteRange