ruby线程编程,ruby等效于java wait/notify/notifyAll [英] ruby thread programming , ruby equivalent of java wait/notify/notifyAll

查看:56
本文介绍了ruby线程编程,ruby等效于java wait/notify/notifyAll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道ruby是Java方法的替代品:

I would like to know what are ruby's alternatives to the Java methods :

  • 等待
  • 通知
  • notifyAll

能否请您发布一个小片段或一些链接?

Could you please post a small snippet or some links ?

推荐答案

基于我不知道Java的警告,基于您的评论,我认为您需要一个条件变量. Google针对"Ruby条件变量"提供了许多有用的页面. 我获得的第一个链接,似乎是对它的快速介绍尤其是条件vars,而看起来它提供了Ruby中线程编程的更广泛的覆盖范围

With the caveat that I don't know Java, based on your comments, I think that you want a condition variable. Google for "Ruby condition variable" comes up with a bunch of useful pages. The first link I get, seems to be a nice quick introduction to condition vars in particular, while this looks like it gives a much broader coverage of threaded programming in Ruby.

这篇关于ruby线程编程,ruby等效于java wait/notify/notifyAll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆