Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- memory* pool_add(Pool * pool, memory * memory_ptr)
- {
- pool->current = pool->head;
- for (int i = 0; i < pool->maxPoolSize; ++i)
- {
- if (pool->current->written == false) {
- pool->current->written = true;
- pool->current->payload = new image;
- cout << "Pool place written " << i << endl;
- if (memory_ptr == NULL) {
- memory_ptr = pool->current;
- cout << "TRAVERSED !" << endl;
- }
- break;
- } else {
- if (i == pool->maxPoolSize - 1) {
- cout << "Pool out Of Memory exception" << endl;
- break;
- }
- pool->current = pool->current->next;
- }
- }
- return memory_ptr;
- }
- void pool_remove(memory *memory_ptr)
- {
- memory_ptr->payload = NULL;
- memory_ptr->written = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement