Is there any parallel in Objective-C to C#'s yield keyword [duplicate]
The first time I saw the yield
keyword in C# I thought "yuck what a way to junk up the language". Having grown since then and actually used the language I find it so pleasantly simple to express state logic that I'd like to use a similar approach in other development platforms.
I'm exploring Objective-C for some support utilities. Is there anything like the C# yield keyword for Objective-C?
There's no real support for it in the language as far as I know, but here's an implementation someone took the time to build, might be helpful.
the NSThread is a wrapper over pthread (according to the documentation) conceptually if all you need is really to yield the thread, you can use pthread_yield().
精彩评论