implemented limited_pool class to limit task count