-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
Occasionally I'd like to do something like "execute on the main queue, but as .immediate
if that would run on the main queue". This is fairly esoteric, but I want it for scenarios like
return makeSomePromise()
.fork({ $0.then(on: .mainImmediate, { (value) in
self.recordValue(value)
})})
The rationale here is if my client then attaches an .immediate
listener and that ends up running on the main thread, I need my own work to have been completed first. In the then
case I can work around this by using .immediate
and dispatching to the main queue myself if I'm not on the main thread, but that won't work for the map
case.
I'm not sold on the .mainImmediate
name.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request