[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

getting a thread id

dmatrix00d

7/10/2006 7:52:00 PM

Is there a way to get the thread id of a thread without passing around
the thread object? I would like to do this because I would like to
pass the thread id of a thread I created as a parameter in a rails
application.

thanks

1 Answer

Jacob Fugal

7/10/2006 8:01:00 PM

0

On 7/10/06, Erich Lin <dmatrix00d@gmail.com> wrote:
> Is there a way to get the thread id of a thread without passing around
> the thread object? I would like to do this because I would like to
> pass the thread id of a thread I created as a parameter in a rails
> application.

You can get the current Thread object via Thread.current. You can then
use the object's id as the "thread id". E.g.:

my_thread_id = Thread.current.object_id

Jacob Fugal