Defer deallocation of the given block to the given heap
| 1116 | |
| 1117 | //! Defer deallocation of the given block to the given heap |
| 1118 | static void |
| 1119 | _memory_deallocate_defer(int32_t heap_id, void* p) { |
| 1120 | //Get the heap and link in pointer in list of deferred opeations |
| 1121 | heap_t* heap = _memory_heap_lookup(heap_id); |
| 1122 | void* last_ptr; |
| 1123 | do { |
| 1124 | last_ptr = atomic_load_ptr(&heap->defer_deallocate); |
| 1125 | *(void**)p = last_ptr; //Safe to use block, it's being deallocated |
| 1126 | } while (!atomic_cas_ptr(&heap->defer_deallocate, p, last_ptr)); |
| 1127 | } |
| 1128 | |
| 1129 | //! Allocate a block of the given size |
| 1130 | static void* |
no test coverage detected