|
Boost : |
Subject: [boost] [thread] getting boost::thread* form boost::thread::id
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-11-13 12:02:11
Hi Anthony,
I'm working with a keep_alive mechanism. I need to interrupt threads that
are considered 'dead'. I have access to the thread specific context using a
map : boost::thread::id -> context. This mapping is modified by self
registration from the thread. On the other side I need a boost::thread
pointer to interrupt the thread.
With the current Boost.Thread interface, I don't see how I can get it either
from the current thread or from the thread::id. Can I?
Currently only the thread creator wrapper can add this information. I think
that I could add a thread creator wrapper that add this as a thread specific
pointer, but I will be able to get only the thread* for the threads created
with this wrapper, which is not completly satisfactory.
Do you think that at least one of these functions could be of general use:
one for getting a boost::thread* form a boost::thread::id and one for
getting the boost::thread* of the current thread?
namespace boost {
class thread {
// ...
static thread* get_thread_ptr(id);
};
namespace this thread {
thread* get_thread_ptr();
}
}
To implement this in Boost.Thread it will be need to store the thread* on
the detail::thread_data_ptr. Do you think that this could be a possible
addition on the Boost.Thread library?
Thanks,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk