pthread_create oddity

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 8 05:40:15 PDT 2015


On 8/7/15 2:20 PM, Steven Schveighoffer wrote:
> On 8/7/15 1:36 PM, Andrei Alexandrescu wrote:
>> I ran into an oddity of pthread_create, see
>> https://github.com/D-Programming-Language/druntime/pull/1340. It appears
>> that if stack size is not explicitly set, the 32-bit version of
>> pthread_create fails. That's happening at least on Ubuntu64 under VMWare
>> hosted on Linux.
>
> What is the stack size using pthread_getstacksize before the setting of it?
>
> I would think with pthread_attr_init, it should be a reasonable default.

pthread_getstacksize indicates 8,388,608 bytes. It doesn't seem 
excessive, but the 32-bit build does find that too big. If I try to set 
stack size to that value with pthread_setstacksize, indeed the thread 
fails. So it's not that you need to call pthread_setstacksize, you need 
to call it with a smaller value. -- Andrei


More information about the Digitalmars-d mailing list