pthread_join hang on glibc2.5


 
Thread Tools Search this Thread
Operating Systems Linux pthread_join hang on glibc2.5
# 1  
Old 11-04-2008
pthread_join hang on glibc2.5

Hello All,
The problem i'm experiencing is with the following code:

#include <pthread.h>
#include <stdio.h>

int main(void)
{
(void) pthread_join(155555, NULL);
printf("done");
return 0;
}

I'm getting on terminal segmentation fault .
System used: CentOS release 5 (Final)
Kernel: 2.6.18-53.1.4.el5
GCC : gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)
GLIBC:GNU C Library stable release version 2.5, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.1 20061011 (Red Hat 4.1.1-30).
Compiled on a Linux 2.6.9 system on 2007-03-14.

pthread_join according to the man should return ERROR in case the thread doesn't exist.

I checked the same code on Red Hat 9 ,2.4.20-31.9, gcc 3.4.3 and GLIBC 2.3.2 and the code returns Error code as expected.

This looks to me as very common use of pthread_join and yet i can't find reference on the web about this error, nor bug listed.

Can someone help ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

ALOM hang

Hi guys, I'm new with solaris. I just received sunfire T2000 server. Problem: ALOM keep hang/stuck/jammed. Steps do before it hang : 1. Connect to T2000 (using RJ45 - DB9 cable) 2. Open putty, connect via serial. 3. Power on the server. 4. Its loading. 5. then, hang. ... (1 Reply)
Discussion started by: rajasraf
1 Replies

2. IP Networking

netstat -a hang

Hi, on our Solaris 10 servers, one day 'netstat -a' command return very slow after TCP output, wait 5 minute on this line - SCTP: Local Address Remote Address Swind Send-Q Rwind Recv-Q StrsI/O State ------------------------------- ------------------------------- ------ ------ ------ ------... (6 Replies)
Discussion started by: ora_dba
6 Replies

3. Programming

pthread_exit and pthread_join usage

Hi... this simple code has warning messages but it work.. void *th(void *g){ int y = 10; pthread_exit((void*)y); } int main(int argn, char ** argp){ void * ret; pthread_t thread; pthread_create(&thread, NULL, th, NULL); pthread_join(thread,... (10 Replies)
Discussion started by: prompt
10 Replies

4. Programming

Doubt on pthread_exit and pthread_join

Main function creates Thread0 and Thread1 by using pthread_create systemcall. In Thread0() { we are calling pthread_exit(0) ; } and in Thread1() { status= pthread_join(tid,NULL); sprintf(ebuf,"timer6: can't join with thread0, status: %d",status); Assert(status==0,ebuf); } ... (4 Replies)
Discussion started by: mansa
4 Replies

5. UNIX for Advanced & Expert Users

pthread_join function

Hi, I would like to know if the call of pthread_join( thread,&status) for a thread already created in main function will free the memory allocated to thread after the pthread_join retruns or should I wait the termination of main function? Is there any need to cancel or exit the thread if I... (0 Replies)
Discussion started by: Behnaz
0 Replies

6. AIX

Boot from CD hang

Why is one of my blade hanging and does nothing after trying to boot from CD??? ================== I tried to press 1....JS20 does not support SMS menu Here's what I see after 30 minutes... ------------------------------------------------------------------------------- ... (0 Replies)
Discussion started by: mifch
0 Replies

7. Shell Programming and Scripting

Ftp hang

Im making a script that goes out to about 200 servers and grabs log files daily and need to make sure the script gets all the servers it can even if one is out. I am ftp'ing the files over but if i cant connect to the server the process looks like it dies and the script is finished. (4 Replies)
Discussion started by: rcunn87
4 Replies

8. Red Hat

system hang

Hello, I am having a HP proliant 350 G3 sever installed wih RedHat linux 9.0 when I enterd using any user(Except root) the server hanged after few seconds, also the folder icons are blacked out and the names of the folder icons are disapper. can any body help me. Ajay (1 Reply)
Discussion started by: ajay234
1 Replies

9. UNIX for Dummies Questions & Answers

How to write my own version of pthread_join()

I would like to write my own version of pthread_join and some of the other pthread function. Does some know any pages that have som examples of doing this?? (1 Reply)
Discussion started by: bigblop
1 Replies

10. Linux

Help for Linux hang up

Hi everybody, i need help regarding my Linux start up.I was trying to configure internet connection with my Red Hat in order to use for Internet,but of no avail and I think I have changed one parameter to activate device during computer start up. Now the problem is during start up and... (1 Reply)
Discussion started by: andysastre
1 Replies
Login or Register to Ask a Question
pthread_join(3C)					   Standard C Library Functions 					  pthread_join(3C)

NAME
pthread_join - wait for thread termination SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_join(pthread_t thread, void **status); DESCRIPTION
The pthread_join() function suspends processing of the calling thread until the target thread completes. thread must be a member of the current process and it cannot be a detached thread. See pthread_create(3C). If two or more threads wait for the same thread to complete, all will suspend processing until the thread has terminated, and then one thread will return successfully and the others will return with an error of ESRCH. The pthread_join() function will not block processing of the calling thread if the target thread has already terminated. If a pthread_join() call returns successfully with a non-null status argument, the value passed to pthread_exit(3C) by the terminating thread will be placed in the location referenced by status. If the pthread_join() calling thread is cancelled, then the target thread will remain joinable by pthread_join(). However, the calling thread may set up a cancellation cleanup handler on thread prior to the join call, which may detach the target thread by calling pthread_detach(3C). See pthread_detach(3C) and pthread_cancel(3C). RETURN VALUES
If successful, pthread_join() returns 0. Otherwise, an error number is returned to indicate the error. ERRORS
EDEADLK A joining deadlock would occur, such as when a thread attempts to wait for itself. EINVAL The thread corresponding to the given thread ID is a detached thread. ESRCH No thread could be found corresponding to the given thread ID. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
pthread_cancel(3C), pthread_create(3C), pthread_detach(3C), pthread_exit(3C), wait(3C), attributes(5), standards(5) NOTES
The pthread_join(3C) function must specify the thread ID for whose termination it will wait. Calling pthread_join() also "detaches" the thread; that is, pthread_join() includes the effect of the pthread_detach() function. If a thread were to be cancelled when blocked in pthread_join(), an explicit detach would have to be performed in the cancellation cleanup han- dler. The pthread_detach() function exists primarily for this purpose. SunOS 5.11 23 Mar 2005 pthread_join(3C)