[C++-sig] Improved version of Lijun Qin's multithreading patch

Niall Douglas s_sourceforge at nedprod.com
Sun Oct 26 05:29:09 CET 2003

Attached is an improved version of Lijun Qin's patched invoke.hpp for 
multithreading. This version solves the following problems:

1. I couldn't find any member function traits in Boost. Odd they 
should be missing, but missing they are from all copies I have.
2. Even if you /do/ have both sets of function traits, they only go 
up to 10 parameters, not BPL's max arity.
3. If you had member variables eg; def_readwrite(), the old patch 
failed to compile.
4. The old patch failed when the parameter types did not have a copy 
5. The old patch wrapped each call in a try...catch() which is 

Steps taken:

1 & 2: I've added my own custom partial specialisation for functions 
and member functions using the exact same preprocessor repeat as 
invoke.hpp uses. Thus the full range of parameters is available.
3: I've added specialisations of detail::member and detail::datum 
with type extractions.
4: I've utilised call_traits to hold converted parameters as 
references where possible. As the C++ standard guarantees an object 
must exist as long as a reference created initialised to it, this is 
5. There's now an object which RAII.

Q: Should I make the return type also a reference? Should save a copy 
construction, but I would need to take call_traits<>::param_type and 
remove the const-ness.


More information about the Cplusplus-sig mailing list