| 1567 | |
| 1568 | |
| 1569 | size_t Resources::count(const Resource& that) const |
| 1570 | { |
| 1571 | foreach ( |
| 1572 | const Resource_Unsafe& resource_, |
| 1573 | resourcesNoMutationWithoutExclusiveOwnership) { |
| 1574 | if (resource_->resource == that) { |
| 1575 | // Return 1 for non-shared resources because non-shared |
| 1576 | // Resource objects in Resources are unique. |
| 1577 | return resource_->isShared() ? CHECK_NOTNONE(resource_->sharedCount) : 1; |
| 1578 | } |
| 1579 | } |
| 1580 | |
| 1581 | return 0; |
| 1582 | } |
| 1583 | |
| 1584 | |
| 1585 | void Resources::allocate(const string& role) |
no outgoing calls