Boost logo

Boost Users :

From: Simmons, Aaron (a-simmons1_at_[hidden])
Date: 2005-09-21 13:39:35


I write a lot of cross-platform code that's used from JNI. In JNI, you
should tell the JVM about native threads that are running. Because Java
threads are named, when you attach a native thread to the JVM you have
to specify a name.

It occurred to me that I could write a "jnithread" class that inherits
from boost::thread. It would take a thread-name argument. Before the
threadfunc runs it would attach the new thread to the JVM, and when the
threadfunc ends it would detach from the JVM.

It's relatively easy to write such a class, and would make life easier
for thread creation within JNI. However, I hesitate because of the lack
of a virtual destructor...

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of me22
Sent: Wednesday, September 21, 2005 1:27 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] inheriting from boost::thread

On 21/09/05, Simmons, Aaron <a-simmons1_at_[hidden]> wrote:
>
> I've been thinking about writing a class that inherits from
boost::thread.
> However, I noticed that the destructor isn't virtual. Shouldn't it
be?
>

boost::thread is designed neither as a base class nor to be used
polymorphically.

Why do you want to inherit from a thread? You still couldn't get at
the private thread handles and there are no virtual functions to
modify behavior.

- 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