开发者

Is there any parallel in Objective-C to C#'s yield keyword [duplicate]

This question already has answers here: Is there anything in Objective-C similar to C# yield return (2 answers) 开发者_开发问答 Closed 3 years ago.

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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜