Reputation: 7659
Use case:
dispatch_get_global_queue
). TIME_OUT
, other requests from the same client can start processing.Using dispatch_get_global_queue
and a serial queuevoid dispatch_after(
dispatch_time_t when,
dispatch_queue_t queue,
dispatch_block_t block)
for each client would be suboptimal when rca1 processing is finished but when
has not arrived yet.
Having a serial queue per customer wouldn't satisfy 5.
I'm aware that GCD is based on a different paradigm but is there any equivalent of pthread_mutex_timedlock or lockBeforeDate or Lock.tryLock in GCD?
How to implement the functionality provided by timed locks using GCD?
Grand Central Dispatch (GCD) Reference
Upvotes: 0
Views: 141
Reputation: 41821
You could have the next job block on a dispatch_semaphore with a timeout. You'd need to wait on job submission, though, not just job execution... otherwise GCD will spin up a ton of threads that immediately wait, which is not what you want.
Upvotes: 0