Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-12-12 14:13:32


There are 2 ways of identifying a thread. If you create a thread, you can
path in the function object any members you like. It is also possible to
pass some id (in case you create threads, you can assign them ids). Another
way of identifying a thread, is doing so by its local storage. A pointer to
a thread local storage will be different for each thread ;)

Regards,
Ovanes

On Dec 12, 2007 7:56 PM, Scott Gifford <sgifford_at_[hidden]> wrote:

> 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.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net