Example: lr_end_transaction

In the following example, the lr_end_transaction function measures the transaction time for performing a deposit to a bank server. Once the server API call is completed and returns a value to the rc variable, the transaction is complete. The user manually sets the transaction status, based on the success or failure of the deposit.

 /* Notify that a transaction is starting */
lr_start_transaction("deposit");

 /* Server API call */
rc = bank_deposit (50);

 /* End transaction with operation result - pass or fail */
if (rc == 0)
    lr_end_transaction("deposit", LR_PASS);
else
    lr_end_transaction("deposit", LR_FAIL);