Enable own pthread implementation

Jonathan Wakely jwakely.gcc@gmail.com
Tue May 20 16:49:00 GMT 2014

On 20 May 2014 17:43, Hiesgen, Raphael wrote:
> Hello,
> we are currently working on a custom pthread implementation. However we ran into a problem using it in conjunction with std::thread.
> Using gcc 4.7.3 this worked fine. When switching to  a version >= 4.8.0 out implementation was no longer accepted and resulted in the "Enable multithreading to use std::thread: Operation not permitted” exception. As a temporary fix I compiled my own gcc 4.8.2 version and removed the ‘__gthread_active_p’ test in the function thread::_M_start_thread. This circumvents the problem, but is no solution.
> Our test system is a 32bit Ubuntu 14.04 VM and the stock gcc 4.8.2 and compiled without additional flags.
> Is this behavior expected? Are we missing something?

Using a custom pthreads implementation is not expected, so it's not
surprising if it doesn't work perfectly.

Take a look at the implementation of __gthread_active_p() in
libgcc/gthr-posix.h and either modify it to handle your implementation
or modify your implementation.

More information about the Libstdc++ mailing list