- Subject: libc/1194: pthread bug triggered by mixing fprintf and fputc
- From: jbpn@adaptivebroadband.com
- Date: Wed Jul 7 08:20:11 1999
Topics:
libc/1194: pthread bug triggered by mixing fprintf and fputc
----------------------------------------------------------------------
Date: Thu, 1 Jul 1999 10:36:16 -0400
From: jbpn@adaptivebroadband.com
To: bugs@gnu.org
Subject: libc/1194: pthread bug triggered by mixing fprintf and fputc
Message-Id: <199907011436.KAA32480@delysid.gnu.org>
>Number: 1194
>Category: libc
>Synopsis: pthread bug triggered by mixing fprintf and fputc
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: libc-gnats
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Thu Jul 01 10:40:01 EDT 1999
>Last-Modified:
>Originator: jbpn@adaptivebroadband.com
>Organization:
net
>Release: 2.1.1-6
>Environment:
Linux santiago.adaptivebroadband.com 2.2.9 #3 Mon Jun 21 11:30:38 BST 1999 i686 unknown
>Description:
Compiling the code included below with the command line:
gcc -lpthread -D_REENTRANT <source file>
and then running it cause a SEGV. It looks a bit like fputc might still have
the same mutex problems that other operations used to have.
>How-To-Repeat:
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <stdarg.h>
#include <unistd.h>
void *thread_a(void *p) {
for (;;) {
fprintf(stderr, "*");
}
}
void *thread_b(void *p) {
for (;;) {
fputc(' ', stderr);
}
}
int main (int argc, char *argv[])
{
pthread_t thread;
pthread_create (&thread, NULL, thread_a, NULL);
pthread_create (&thread, NULL, thread_b, NULL);
for (;;) {
sleep(30);
}
return 0;
}%0
>Fix:
>Audit-Trail:
>Unformatted:
------------------------------
End of forwardtJBecT Digest
***************************