Serious thread problem? [email@example.com: Perl 5.8.1 crash description]
Mon Aug 18 14:45:00 GMT 2003
Christopher Faylor wrote:
> On Fri, Aug 08, 2003 at 08:12:36AM +1000, Robert Collins wrote:
>>On Fri, 2003-08-08 at 08:06, Christopher Faylor wrote:
>>>----- Forwarded message from Pavel Tsekov <firstname.lastname@example.org> -----
>>>Now, when reentrant structures are allocated as part of the
>>>Cygwin thread creation, these structures are allocated on
>>>the thread stack. Newlib keeps a pointer to one of this
>>>reentrant structures in the FILE structure.
>>Dang. I'm not -sure- of the posix expected behaviour for fdopen(), but
>>I'm pretty sure it's meant to return a process-file FILE pointer, not
> Yes, that's my impression, too.
Sorry for being late, but i was 3 weeks away for vacation.
Here is a smaller testcase which triggers the same problem:
static FILE *fp;
static void *threadfunc (void *parm)
fp = fopen ("/tmp/testreent", "w");
pthread_create (&thread, NULL, threadfunc, NULL);
pthread_join (thread, NULL);
fprintf (fp, "test");
As Pavel already pointed out this is a problem with the _reent member in
the FILE structure definition.
I have no clue how this meant to work in newlib, it might be better to
disable __DYNAMIC_REENT__ again until newlib is really thread safe.
I will start a discussion at the newlib ml.
More information about the Cygwin-developers