From 4b9fae607d11d520d4ce33b2a314cb462759e87f Mon Sep 17 00:00:00 2001 From: Jan Vcelak <jan.vcelak@nic.cz> Date: Fri, 12 Sep 2014 13:42:54 +0200 Subject: [PATCH] tests: worker_pool_suspend, worker_pool_resume refs #296 --- tests/worker_pool.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/worker_pool.c b/tests/worker_pool.c index 6a5bcb432..e644aa63a 100644 --- a/tests/worker_pool.c +++ b/tests/worker_pool.c @@ -112,6 +112,21 @@ int main(void) worker_pool_wait(pool); ok(executed_reset(&log) == TASKS_BATCH, "executed count after add"); + // temporary suspension + + worker_pool_suspend(pool); + + for (int i = 0; i < TASKS_BATCH; i++) { + worker_pool_assign(pool, &task); + } + + sched_yield(); + ok(executed_reset(&log) == 0, "executed count after suspend"); + + worker_pool_resume(pool); + worker_pool_wait(pool); + ok(executed_reset(&log) == TASKS_BATCH, "executed count after resume"); + // try clean pthread_mutex_lock(&log.mx); -- GitLab