I see this patch removes one unnecessary function call. I think we might be able to remove one more function call from pthread_* functions to pthread::* functions. I think it could be possible using GCC's feature of emitting aliases of functions. This has unfortunately an inconvenience, one needs to have a mangled C++ function name to be able to define the alias properly. I tryed this simple test but haven't investigated it more thoroughly.
Vaclav Haisman #include <cstdio> void f () { printf ("f()\n"); } void g () __attribute__ ((alias ("_Z1fv"))); class A { public: static int static_func (int); }; int A::static_func (int x) { printf ("A::static_func()"); return 1; } extern "C" int global_func (int) __attribute__ ((alias ("_ZN1A11static_funcEi"))); int main () { g (); global_func (1); }