在信号量保护下执行任务
Future<T> withLock<T>(Future<T> Function() task) async { await acquire(); try { return await task(); } finally { release(); } }