When I add a job into the queue, DispatchWorkItemFlags gives us several options to choose
public func sync<T>(flags: DispatchWorkItemFlags, execute work: () throws -> T) rethrows -> T
public static let barrier: DispatchWorkItemFlags
public static let detached: DispatchWorkItemFlags
public static let assignCurrentContext: DispatchWorkItemFlags
I know barrier makes the job not being executed the same time with others, but I don't know what detached and assignCurrentContext are, and Apple don't provide any description about them, so who can tell me about this.
You can read about them in the dispatch_block_flags_t manual:
DISPATCH_BLOCK_ASSIGN_CURRENTIndicates that a dispatch block should be assigned the execution context attributes that are current at the time the block object is created. …
DISPATCH_BLOCK_BARRIERIndicates that a dispatch block should act as a barrier block when submitted to a DISPATCH_QUEUE_CONCURRENT queue. …
DISPATCH_BLOCK_DETACHEDIndicates that a dispatch block should execute disassociated from current execution context attributes such as QoS class, os_activity_t, and properties of the current IPC request, if any. …
I’ve only copied the first sentence from each flag’s documentation. Click the link for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With