Thread id's

how does one go about getting the thread id from within the thread
itself?

i'm aware that Thread.list returns an array of thread objects (running
or stopped), i was looking for a way of identifying which object id
belonged to which thread...

eg.

a=Thread.new {
   #what's a's thread id?
}

b=Thread.new {
   #what's b's thread id?
}

tony summerfelt wrote:

how does one go about getting the thread id from within the thread
itself?

i'm aware that Thread.list returns an array of thread objects (running
or stopped), i was looking for a way of identifying which object id
belonged to which thread...

Thread.current will tell the current thread id.

Also Thread.main will give you the main thread, and
Thread.list will give you all of them.

Hal

and there it is right on page 390 of the pick axe book...right where i
have a bookmark...don't ask me how i missed that...

thanks :slight_smile:

···

On Wed, 23 Jun 2004 11:14:55 +0900, you wrote:

Thread.current will tell the current thread id.