$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Scott Gifford (sgifford_at_[hidden])
Date: 2007-12-12 13:56:41
Igor <Igor.Smirnov_at_[hidden]> writes:
> Could you please explain for beginner in thread-related business,
> how the thread is identified from itself? Can the program, that it
> the given thread, obtain its own number or an index of itself? I
> assume that there should be some enumeration such as numbering the
> main program by 0, next child thread by 1, etc.? And, in particular,
> is this number available from boost thread library?
Igor,
As far as I know, boost::thread does not provide any mechanism for
this. However, you can use OS-specific system calls to get this
information. For example, on my Unix system I use pthread_self() to
get a thread ID.
boost::threads are very portable and so implement only the
functionality that can be provided identically on all platforms.
That's their greatest strength and their greatest weakness.
Good luck!
----Scott.