Scope of Function wrt Threads

I have a  questions about MultiThreading (I am new to threads hence this may be trivial)
I have started a thread from inside of a function does that mean the function wont return as long as the thread idoes
not exit?Or is it that once started the thread can continue even if the function from where it was called returns.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>> have started a thread from inside of a function does that mean the function wont return as long as the thread idoes
>>not exit?

No.  The function will continue regardless if the thread exists

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
That is the whole point of threads.  Create a thread and it then runs independantly of the main program.  
That is also the nightmare of threads.  There is no built-in synchronisation between the application and any threads is creates.  Each will run independantly and you can't assume (for instance) that the thread will finish its task before the app requires the results.
Threads are allocated CPU time by scheduler.Internally they are kernel objects(created by kernel,Manipulated by kernel,Destroyed by kernel).Every thread has its own stack with data.

If the function does not return till the other thread executes then it behaves like a single threaded app.Then there is no meaning of multithreading(used for better user responsiveness).The purpose of multithreading is to execute jobs independently(ofcourse some times with syncronization).if u want to make that function wait as per ur requrirement we can use functions like WaitForSingleObject(.....).

void f1()//this function belongs to a seperate thread



UINT ThreadProc(LPVOID lp)//the instructions in this thread inedepnedent of above function.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.