信号量,使当前线程只执行一件事
dispatch_semaphore_t frameRenderingSemaphore;
create frameRenderingSemaphore = dispatch_semaphore_create(1);
wait dispatch_semaphore_wait(frameRenderingSemaphore, DISPATCH_TIME_NOW) != 0
singal dispatch_semaphore_signal(frameRenderingSemaphore)
release dispatch_release(frameRenderingSemaphore)
frameRenderingSemaphore = DispatchSemaphore.init(value: 1)
frameRenderingSemaphore?.wait(timeout: DispatchTime.now()) == .timedOut
frameRenderingSemaphore?.signal()