05-25-2009
Mansa, I suspect the "join" in pthread_join() is confusing you.
In POSIX threads terminology a join is actually a wait i.e. the calling thread (in your case thread 1) blocks until the specified thread has exited (in your case thread 0). It is equivalant to Win32's NTWaitForSingleObject()/WaitForSingleObject() or the old OS/2 DosWaitThread().
Not all threads can be joined. If you specified a detached thead at creation time, such a thread cannot be joined. Also any thread can call pthread_join() on any other thread but the exiting thread can only be joined once.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. UNIX for Advanced & Expert Users
We had written an application in which we create worker thread.
So the main thread will create the worker thread. After some time
the child thread(Worker thread) will call pthread_exit().
This function was written in try{} and there occured an Exception
and is handled in catch(...)... (0 Replies)
Discussion started by: platso
0 Replies
3. Linux
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:... (0 Replies)
Discussion started by: crocodil
0 Replies
4. UNIX for Advanced & Expert Users
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
5. Programming
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
6. Shell Programming and Scripting
Hi,
I have a file with multiple entries and I have calculated the percentages. Now I want to know how many of my entries are there between 1-10% 11-20% and so on..
chr1_14401_14450 0.211954217888936
chr1_14451_14500 1.90758796100042
chr1_14501_14550 4.02713013988978... (1 Reply)
Discussion started by: Diya123
1 Replies
7. Programming
Hi,
I am new to multithreaded programming. When creating a thread to run a specific function, does the function need to have a pthread_exit ?
Is pthread_exit analogous to a return in a function? (3 Replies)
Discussion started by: sanjayc
3 Replies
8. Red Hat
I need help in opening the .exe files in linux. As i have downloaded ubuntu os from trail version.
after executing the the file name in terminal it is stating that get archive files for opening the .exe files.
But i am unable to get it
please help me (2 Replies)
Discussion started by: yashwanthguru
2 Replies
9. Red Hat
How to create a file with specific size in RHEL6 (1 Reply)
Discussion started by: Sashi Kanth A
1 Replies
10. Shell Programming and Scripting
Hi experts,
In one of our code we have used some command like this.
name=${name##*/}
Can someone please let me know what exactly it does?
Thanks & Regards,
Sathya V. (1 Reply)
Discussion started by: Sathya83aa
1 Replies