[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: pthreads

Tim Pease

12/1/2006 4:36:00 PM

On 12/1/06, Shane Emmons <semmons99@gmail.com> wrote:
> I need to write a quicksort using pthreads, and was hoping to use Ruby to do
> so (the Prof. just loves C/C++). Can anyone shed some light on what
> compiling ruby with pthreads actually does, and what I need to do to write
> pthreads in Ruby? Thanks for any help.
>

The pthreads option when compiling Ruby is there to make it play nice
with the Tcl/Tk widget set. If your Tcl/Tk is compiled with the
pthreads option, then Ruby needs to be compiled with the pthreads
option. If this is not the case then you could get segmentation faults
when you try to use the Tcll/Tk widgets.

Ruby does not use pthreads internally. All threads are implemented as
green threads -- i.e. there is only one Ruby process and all threads
are scheduled internal to that process.

If your professor truly wants pthreads for your quicksort assignment,
then Ruby is not going to make him happy. However, if you can convince
him that the Ruby Thread object is good enough (close enough) to a
pthread, then more power to ya!

Blessings,
TwP