multithreading - Derived class for Ruby Thread? -


I've lived in the C ++ world for years, and I'm starting with Ruby. I have a class that I want to make a thread. Is it wrong to get a square from ruby ​​in ruby? I look at examples that use the concepts given below.

  thread.nu {& lt; Some blocks & gt; }  

What would be wrong with doing this?

  class MyThread & lt; Thread DEF started running end DRF; & Lt; Main loop & gt; I think this is actually a question about domain modeling. I think it's really a question about domain modeling.  

If you want to increase / increase the behavior of a thread, nothing will be wrong with what you are doing - for example to add debug or display output, but not me Feel what you want.

You probably want to model some concept in your domain with active objects, in that case the standard ruby ​​approach is better because it allows you to get it without bowing your domain model.

Legacy should really be used only to model IS_A relations

To activate its object, it has been captured in a newly built bag in any method

  Class MyClass .... While running def defining work_to_be_done some work ends ... end thread = [] # To create an active object by creating an object and # assigning a thread to each thread & lt; & Lt; Thread.nu {MyClass.new.run} thread & lt; & Lt; Thread.New {MyOtherClass.new.run} ... do more stuff # Now we are just waiting to finish all the objects .... threads.each {| T | T.join} # Ok, everything is done, see the starship on the shoulder from the shoulder ... # Time to die ...  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -