/** * @brief Pops an item off the stack. * * @return The popped Coordinate. */ Coordinate CoordinateStack::pop() { /* Do the operation. */ Coordinate c = do_pop(); #ifndef TESTSUITE /* Update the display. */ SDL_Delay(ANIMATION_DELAY); this->app->OnRender(); #endif return c; }
void push_pop_test(infq_t *q) { int m, n; for (int i = 0; i < 50 * 60000 || infq_size(q) != 0; i++) { if (i < 50 * 60000) { if (infq_push(q, &i, sizeof(i)) == INFQ_ERR) { printf("failed to push\n"); return; } printf("push => %d, s => %d\n", i, infq_size(q)); if (i % 500 == 0) { sleep(1); } } if (i % 60 == 0) { m = i > 40 ? 40 : i - 1; if (m > 0) { n = rand() % m; do_pop(q, n); } } if (i % 33 == 0) { check_at(q); } } sleep(3); printf("fin sleep"); int *data; int size; for (int i = 0; i < 4000000; i++) { if (infq_pop_zero_cp(q, (const void **)&data, &size) == INFQ_ERR) { printf("failed to pop\n"); } } }
public: void pop() { do_pop(); }
char * pop_string (List *stack) { return do_pop (stack, 1); }
void * pop (List *stack) { return do_pop (stack, 0); }