RubyCocoa 中的异步方法
我知道在 RubyCocoa 中使用线程是不可能/不明智的。 然而,可以使用异步 Cocoa 方法来避免阻塞用户界面事件。
我已成功使用 NSURLConnection
上的方法发送 HTTP 请求并接收响应,而不会阻塞用户界面。 但我想知道还有哪些其他类似的异步 Cocoa 方法可用?
另外,在 RubyCocoa 应用程序中使用 Ruby 生成单独的进程(而不是线程)是否可能/明智? 我想一个问题是如何等待该过程完成,但这也许可以通过 NSTimer 事件轮询来完成?
I understand that it isn't possible/sensible to use threads in RubyCocoa. However it is possible to use asynchronous Cocoa methods to avoid blocking user interface events.
I've successfully used a method on NSURLConnection
to send an HTTP request and receive the response without blocking the user interface. But I'm wondering what other asynchronous Cocoa methods like this are available?
Also is it possible/sensible within a RubyCocoa application to use Ruby to spawn separate processes (as opposed to threads)? I suppose one issue would be how to wait for the process to complete, but perhaps this could be done by polling via NSTimer events?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查一下这个客户端,它是用 ruby 编写的并且运行得很好。
httpclient
Check this client, it's written in ruby and works pretty well.
httpclient