This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Enable own pthread implementation
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "Hiesgen, Raphael" <Raphael dot Hiesgen at haw-hamburg dot de>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 20 May 2014 17:49:43 +0100
- Subject: Re: Enable own pthread implementation
- Authentication-results: sourceware.org; auth=none
- References: <122E8B7D-0AFA-4288-98AF-2AC760D2FE05 at haw-hamburg dot de>
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.