Throwing closures are definitely still very awkward, esp w/ async.
Conversation
relevant: My library to convert betw (a)sync functions /w errors
1
Isn't updated to beta 6 yet, but I'm making great use of throwing closures there
1
Using semaphores to covert async to sync like that will lead to excessive system threads.
3
2
Thanks for the feedback! Do you think dispatch_group would be better?
1
Unfortunately there is no unwasteful method of converting arbitrary async calls to sync calls on Apple’s platform.
1
I think I'll make some speed tests and change it to the fastest
2
It’s not really about “fast” in terms of execution time: the issue is that blocking a system thread uses up kernel resources.
1
2
interesting. Can you maybe link me to a relevant resouce so I can include this information in the disclaimer?
2
Just came across this discussion, I would be also very happy to know “why” is bad. Currently thinking of implementing a map like method that operates async calls on a list so it would be very helpful to have a clearer understanding about disadvantages.
1
Even 280 not enough! Consider how threads, blocking calls, and scheduling actually work at an OS level. Threads are a limited resource, (relatively) expensive to spin up and (relatively) costly to switch between. Usually not a big deal for brief operations, but requires thought.
Thanks Andy! Sharing what I found also, here goo.gl/KXLDGt, table 3-2 talks about required messages to be sent to kernel level (the overhead). Though the semaphors seem to eliminate such massaging exchange when no halt needed. I need to learn more on OS.



