[812] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Strange behaviour

daemon@ATHENA.MIT.EDU (Wolfgang =?iso-8859-1?Q?R=F6mer?=)
Thu Mar 11 11:06:59 1999

Date: Thu, 11 Mar 1999 16:47:04 +0100
From: Wolfgang =?iso-8859-1?Q?R=F6mer?= <Wolfgang.Roemer@brokat.com>
To: pthreads@MIT.EDU

Hi,

some strange behaviour occured to me concerning the following code:


-----------------cut here--------------------------------

#include <sys/types.h>

/********************************************************************************

 * This program (named test1) forces an error when compiled and linked
as follows:
 *
 *       gcc -o test1 test1.c -lpthreads
 *
 * I know it seems strange to link this program with the pthreads
library because
 * it does not use pthreads, but this test program is only a part of a
much larger
 * program that uses pthreads and I could not get it to work on Linux
(It works great
 * on solaris, aix and hpux). In 2 days of work I could reduce the
problem to this
 * dummy program. Linking without the pthreads makes the program run
fine.
 *
 * Sympthoms:
 * CPU load is 100% and the child never stops
 *
 * Environment:
 * SuSE Linux 5.3, Kernel 2.0.36, gcc-2.7.2.1, libc5.4.33,
libpthreads1.60.4
 *
 * (The problems appears with Kernel 2.0.35 as well.)
 ********************************************************************************/



int main()
{
   pid_t pid = fork();
   if( pid < 0 )
   {
      perror( "test" );
      exit(1);
   }
   else if( pid > 0 )
   {
      /* this is the parent */
      waitpid( pid, NULL, 0 );
      exit(0);
   };

   /* this is the child */
   sleep(10);

   exit(0);
}


-------------------cut here-------------------------------

Any ideas

Wolfgang


home help back first fref pref prev next nref lref last post