[cpp-threads] Proposing a layered Thread API

Ion Gaztañaga igaztanaga at gmail.com
Sat Sep 2 18:18:03 BST 2006


Kevlin Henney wrote:
> Ion Gaztañaga <igaztanaga at gmail.com> writes
>>
>> Thoughts? Do you see a 3 level approach correct? It's too complicated? 
>> Too hard to implement?
> 
> My gut instinct is that it will be perceived as overly complicated. Any 
> issues concerning implementation are almost irrelevant in comparison to 
> the question of usability. Two levels seems simple and effective enough, 
> as well as easy to explain, but the three levels presented are 
> conceptually too close and offer more choice than most would consider 
> desirable, useful or practical. In library design, more choice does not 
> necessarily equate with better.

So I suppose you prefer levels 0 and 2, with a direct OS control plus a 
reference counted future?

I think that can have a big performance impact. Like parallelization 
software (OpenMP, Intel Thread Building Blocks...), the user will prefer 
a main thread parallelizing loops and asynchronous IO/threads so that 
the main thread launches and joins all the operations. In that case, I 
think that reference-count + copy is quite expensive.

I don't know what Java Future interface does and if concurrent joins 
from different threads at the same time are used, but I would like to 
see an example to convince me that reference counted + concurrent joins 
are really meeded.

Regards,

Ion



More information about the cpp-threads mailing list