This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
C++ constructor calling futex_wake then _spin_lock
- From: "Xavier R. Guérin" <guerinx at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 9 Jul 2012 21:54:40 -0400
- Subject: C++ constructor calling futex_wake then _spin_lock
Hi list,
I am experimenting with RAII for locks and uses a stack object to initialize a lock. While this method is very practical, using it on the critical path of my application shows extremely strange behaviors.
It looks like somehow kernel spin locks, through futex, are involved during the construction and destruction of my RAII locker. Is this an expected behavior? It's rather counter intuitive and extremely expensive (70% CPU time with multiple threads).
Thanks,
Xavier