LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2005, 04:20 PM   #1
stonehurstX11
Member
 
Registered: Dec 2003
Location: New Jersey, USA
Posts: 120

Rep: Reputation: 15
When to call pthread_exit?


Hey there.
I started working with PThreads recently and I have this one question. In my routine function, which is written in C++, should I call pthread_exit? I'm not sure about this since I heard someone mention that it isn't necessary in C++ code.

For example:
Code:
void* SomeFunction(void *data) {
   // do some stuff here
   // ...
   
   // do I need to call this?
   pthread_exit(NULL);
}
Any ideas? Thanks in advance.
 
Old 06-27-2005, 05:57 PM   #2
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
You don't need to call this. But you need to call a pthread_join(Thread_ID,status) in the main program, from where you created the thread with pthread_create. This is called synchronization and is neccesary for the program to execute as planned.
 
Old 06-27-2005, 06:25 PM   #3
stonehurstX11
Member
 
Registered: Dec 2003
Location: New Jersey, USA
Posts: 120

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by marghorp
You don't need to call this. But you need to call a pthread_join(Thread_ID,status) in the main program, from where you created the thread with pthread_create. This is called synchronization and is neccesary for the program to execute as planned.
Alrighty then, I'll look into pthread_join more closely. Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
not sure what to call it Solvaut Linux - Newbie 12 07-18-2005 03:22 AM
make a call bhughesiii Linux - General 4 12-23-2004 09:12 AM
using system call ej25 Programming 9 11-30-2004 11:45 AM
What do you call your remote control? I call mine... RHLinuxGUY General 19 10-18-2004 06:23 AM
Call to arms! Nimoy LQ Suggestions & Feedback 4 10-12-2003 02:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration