* Mike - EMAIL IGNORED:
I have changed the design for now. The problem is that in many,
if not all classes that create posix threads, it is necessary to
call pthread_create() after all objects in the inheritance
sequence have been fully created. This would be in the constructor
of the most derived class. If a class may or may not be
inherited, It needs to determine whether pthread_create() should be
called at that level. A less attractive alternative is to require
an initialize() after construction. I would like a way to avoid
this.
There are several design choices, then. Off the cuff:
* If possible, let all classes inherit down a chain from some Runnable
class, which can only be used by passing it to the run() function of
a Thread object. Or similar design directly in Thread.
* Full separation of interfaces and concrete classes, where concrete
classes can't be derived from (I don't like this, but).
* Use virtual inheritance to impose a final CRTP derivation to obtain
a concrete class, which you ensure can't be derived from.
You're not the first to have this problem, and last I discussed this
with an acknowledged C++ expert, one who I regard as real expert (in
spite of our disagreement about nearly everything!), he rejected all
three possibilities above as not-quite. However, he was then arguing
for introducing a kind of post-construction-pre-destruction facility to
the language, and I think his arguments were designed to argue the case
for that facility, not to find just a practical design space solution.
Hopefully one of the possibilities above, or some other, will help you.
PS: Please don't quote signatures. A usenet posting signature is
delimited from the preceding text by a line consisting of two hyphens
and a space. Your news client should remove it automatically.