test/service: fix race condition on stopping lcore