| 125 | } |
| 126 | |
| 127 | bool getNewVirtualId(IdType *id) |
| 128 | { |
| 129 | bool res = false; |
| 130 | |
| 131 | _do_lock_tbl(); |
| 132 | // TODO(kapil): _idMapTable contains not only ids created by this process, |
| 133 | // but also other ids that are created by other processes. This function |
| 134 | // shouldn't consider the latter ids. |
| 135 | if (_idMapTable.size() < _max) { |
| 136 | size_t count = 0; |
| 137 | while (1) { |
| 138 | IdType newId = addOneToNextVirtualId(); |
| 139 | id_iterator i = _idMapTable.find(newId); |
| 140 | if (i == _idMapTable.end()) { |
| 141 | *id = newId; |
| 142 | res = true; |
| 143 | break; |
| 144 | } |
| 145 | if (++count == _max) { |
| 146 | break; |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | _do_unlock_tbl(); |
| 151 | return res; |
| 152 | } |
| 153 | |
| 154 | bool isIdCreatedByCurrentProcess(IdType id) |
| 155 | { |
nothing calls this directly
no test coverage detected