getting a thread id

E

Erich Lin

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
 
J

Jacob Fugal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,208
Messages
2,571,082
Members
47,683
Latest member
AustinFairchild

Latest Threads

Top