#include <LockHolderId.h>
Public Member Functions | |
LockHolderId () | |
Creates a new null holder. | |
LockHolderId (TxnId txnId) | |
Creates a new ID corresponding to a transaction or thread ID. | |
void | assignFrom (TxnId txnId) |
Assigns identity from a transaction or thread ID. | |
bool | isNull () const |
| |
void | setNull () |
Sets this holder to null. | |
int | operator== (LockHolderId const &other) const |
Compares this holder to another. | |
Private Types | |
enum | HolderType { TYPE_NULL, TYPE_THREAD, TYPE_TXN } |
Private Attributes | |
TxnId | holderId |
HolderType | holderType |
Definition at line 35 of file LockHolderId.h.
enum LockHolderId::HolderType [private] |
Definition at line 37 of file LockHolderId.h.
00037 { 00038 TYPE_NULL, 00039 TYPE_THREAD, 00040 TYPE_TXN 00041 };
LockHolderId::LockHolderId | ( | ) | [inline, explicit] |
Creates a new null holder.
Definition at line 108 of file LockHolderId.h.
References setNull().
00109 { 00110 setNull(); 00111 }
LockHolderId::LockHolderId | ( | TxnId | txnId | ) | [inline, explicit] |
Creates a new ID corresponding to a transaction or thread ID.
txnId | ID of a transaction, or IMPLICIT_TXN_ID to assign from the current thread ID |
Definition at line 113 of file LockHolderId.h.
References assignFrom().
00114 { 00115 assignFrom(txnId); 00116 }
void LockHolderId::assignFrom | ( | TxnId | txnId | ) | [inline] |
Assigns identity from a transaction or thread ID.
txnId | ID of a transaction, or IMPLICIT_TXN_ID to assign from the current thread ID |
Definition at line 89 of file LockHolderId.h.
References getCurrentThreadId(), holderId, holderType, IMPLICIT_TXN_ID, TYPE_THREAD, and TYPE_TXN.
Referenced by LockHolderId().
00090 { 00091 if (txnId == IMPLICIT_TXN_ID) { 00092 // NOTE jvs 2-Jun-2007: Not exactly posixly correct, 00093 // but it will probably do for most environments. 00094 holderId = TxnId(uint(getCurrentThreadId())); 00095 holderType = TYPE_THREAD; 00096 } else { 00097 holderId = txnId; 00098 holderType = TYPE_TXN; 00099 } 00100 }
bool LockHolderId::isNull | ( | ) | const [inline] |
Definition at line 118 of file LockHolderId.h.
References holderType, and TYPE_NULL.
Referenced by SXMutex::tryUpgrade(), and SXMutex::~SXMutex().
00119 { 00120 return holderType == TYPE_NULL; 00121 }
void LockHolderId::setNull | ( | ) | [inline] |
Sets this holder to null.
Definition at line 102 of file LockHolderId.h.
References holderId, holderType, NULL_TXN_ID, and TYPE_NULL.
Referenced by LockHolderId(), and SXMutex::release().
00103 { 00104 holderId = NULL_TXN_ID; 00105 holderType = TYPE_NULL; 00106 }
int LockHolderId::operator== | ( | LockHolderId const & | other | ) | const [inline] |
Compares this holder to another.
other | other holder to compare |
Definition at line 123 of file LockHolderId.h.
References holderId, and holderType.
00124 { 00125 return (holderId == other.holderId) 00126 && (holderType == other.holderType); 00127 }
TxnId LockHolderId::holderId [private] |
Definition at line 43 of file LockHolderId.h.
Referenced by assignFrom(), operator==(), and setNull().
HolderType LockHolderId::holderType [private] |
Definition at line 44 of file LockHolderId.h.
Referenced by assignFrom(), isNull(), operator==(), and setNull().