[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with libpthread.so not with libpthread.a
From: |
Paul Pinault [Netline] |
Subject: |
problem with libpthread.so not with libpthread.a |
Date: |
Wed, 14 Feb 2001 17:31:01 +0100 |
There can be a matter with thread and pthread dynamic library :
When I compile the example (see below) with :
gcc -o stopthreadfils stopthreadfils.c /usr/lib/libpthread.a
the bcl script ( see below ) never stop... this is a normal case.
When I use
gcc -o stopthreadfils stopthreadfils.c -lpthread
bcl freeze after some loops... All process (thread) are sleeping and they
never wake up... So this is not a normal case...
I don't know where the matter is ...
<<<< ------------------ STOPTHREADFILS ---------------->>>>>
#include <stdio.h>
#include <pthread.h>
#include <sys/types.h>
#include <signal.h>
pid_t mainpid;
int function2(pthread_t fatherID)
{
int i=0;
printf("\n my father is %d \n\n",fatherID);
pthread_kill(fatherID, SIGSTOP);
printf("I am the child\n");
while(i<200)
{
putchar('.') ;fflush(stdout);
i++;
}
putchar('\n');
kill(mainpid,SIGKILL);
}
int function1(void)
{
int i;
pthread_t threadID2=-1;
pthread_create(&threadID2, NULL, function2, (void *)pthread_self());
while(1)
{
printf("I am the father of (%d)\n",threadID2);
for ( i = 0 ; i < 300000 ; i ++ );
}
}
int main(int argc, char *argv[])
{
pthread_t threadID1=-1;
mainpid = getpid();
printf("mainpid : %d \n",mainpid);
pthread_create(&threadID1, NULL, function1, NULL);
while(1){ printf(" \n Steel Living \n"); sleep (2); }
return 0;
}
<<< ------------------ BCL SCRIPT ------------------->>>>>>>
#!/bin/sh
while [ 1 -eq 1 ]
do
./stopthreadfils
done
-------------------------------------------------
Paul Pinault - NETLINE -
15-17 rue du pre la reine
63100 Clermont-Ferrand
Tel : 04 73 14 62 78
email : address@hidden
web : www.netline.fr
------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- problem with libpthread.so not with libpthread.a,
Paul Pinault [Netline] <=