MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / getNewVirtualId

Method getNewVirtualId

include/virtualidtable.h:127–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 4

endMethod · 0.80
_do_lock_tblFunction · 0.50
_do_unlock_tblFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected