MCPcopy Create free account
hub / github.com/F-Stack/f-stack / HeapDelete

Method HeapDelete

adapter/micro_thread/heap.h:281–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281inline int HeapList::HeapDelete(HeapEntry* item)
282{
283 if (HeapEmpty()) {
284 return -1;
285 }
286
287 int pos = item->GetIndex() ;
288 if ((pos > _count) ||(pos <= 0))
289 {
290 heap_assert(0); // duplicated deletion or illegal data.
291 return -2;
292 }
293
294 HeapEntry* del = _list[pos];
295 _list[pos] = _list[_count];
296 _list[pos]->SetIndex(pos);
297
298 _list[_count] = 0;
299 _count--;
300
301 HeapDown(pos);
302 heap_assert(pos == del->GetIndex());
303 del->SetIndex(0);
304 return 0;
305}
306
307
308inline void HeapList::HeapForeach()

Callers 4

stop_timerMethod · 0.80
check_expiredMethod · 0.80
RemoveSleepMethod · 0.80
DeleteFromHeapMethod · 0.80

Calls 2

GetIndexMethod · 0.80
SetIndexMethod · 0.80

Tested by

no test coverage detected