The lock manager provides read-guards for individual object managed by the product catalogue and read/write guards for the various lists of objects.
For each type of object maintained by the product catalogue, the lock manager uses a RwMutex (priority for readers) to control the access to the respective list.
This means that multiple read-locks may be aquired by clients of the lock manager. However a write-lock should be requested only if NO OTHER LOCK is held. This has the following consequence: Because the product catalogue needs write-locks when creating, changing or deleting object, a client must NEVER hold a lock when calling such a method of the product catalogue.
Currently only products, product nodes and product items are supported.
Product nodes are not locked individually. Instead their product is locked. Because of this there is need to provide locks for all nodes of a product.
Copy constructor and destructor by compiler, compiler generated assignment operator breaks because of assignment to a reference.
Definition at line 523 of file productcat.h.
typedef ReadGuard<Product*> OSB_LIB::PcatLockMgr::ProductRg |
Write guard for the product list.
Definition at line 558 of file productcat.h.
Status of the issued guards.
success | Success: none of the other values. |
lockFailed | Failed to lock. |
objectNotFound | Object does not exist. |
wrongPiType | Wrong product item type. |
Definition at line 562 of file productcat.h.
OSB_LIB::PcatLockMgr::PcatLockMgr | ( | ProductCatalogue & | pcat | ) |
PricelistRg OSB_LIB::PcatLockMgr::readLock | ( | const Pricelist::Oid & | id | ) |
Read-lock a price list by its object id.
ProductNodeRg OSB_LIB::PcatLockMgr::readLock | ( | const Product::Oid & | pdId, | |
const ProductNode::Oid & | pnId | |||
) |
Read-lock a product node.
ProductRg OSB_LIB::PcatLockMgr::readLock | ( | const Product::Oid & | id | ) |
Read-lock a product by its object id.
ProductsRg OSB_LIB::PcatLockMgr::readLockPds | ( | ) |
Read-lock all products.
PricelistsRg OSB_LIB::PcatLockMgr::readLockPls | ( | ) |
Read-lock all price lists.
ProductsWg OSB_LIB::PcatLockMgr::writeLockPds | ( | ) | [private] |
Write-lock the list of all products.
PricelistsWg OSB_LIB::PcatLockMgr::writeLockPls | ( | ) | [private] |
Write-lock the list of price lists.
friend class ProductCatalogue [friend] |
ProductCatalogue& OSB_LIB::PcatLockMgr::pcat_ [private] |
RwMutex OSB_LIB::PcatLockMgr::pdMutex_ [private] |
RwMutex OSB_LIB::PcatLockMgr::plMutex_ [private] |