
Peter Dimov wrote:
Rene Rivera wrote:
Not that the use case makes any sense to me :-( So I'm still guessing as to what you want to achieve with thread safety here.
The idea is that the function f - if we use an ordinary C callback instead of make_c_function - is thread safe when called at the same time from multiple threads to sort different arrays. make_c_function breaks this thread safety because of its assignments to the underlying boost::function.
I think.
I don't buy that one. At call time the thread safety of a plain C function is the same as C function returned from make_c_function, in a transitive sense. If there's any thread unsafeness it's in the context used for the bind, if there is one. That context has the same thread safety as any other context one would need to make use of a C function to execute the same C++ code as the bind would call, or any other piece of C or C++ code. The one caveat would be if boost::function is non-const in behavior for every call. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo