views:

65

answers:

2

i have defined one thread fucntion inside .cpp file and i have called createThread function to create thread it is working fine.if i declare thread function declartion in .h file and definition in .cpp file means the thread is not executing immedialty the applcation quits.i'm creating a thread from main().what is the problem in this scenorio.

+2  A: 

Yes, you definitely can. All you need is a handle to the created thread (CreateThread() returns that unless it fails). As long as you have the handle value and no part of your code has called CloseHandle() on that value you can use any waiting function.

sharptooth
A: 

Hi,

You can use the following code: // This class extends Thread class BasicThread1 extends Thread { // This method is called when the thread runs public void run() { } }

// Create and start the thread
Thread thread = new BasicThread1();
thread.start();

Thanks

Deepak Kumar
The OP doesn't appear to be using Java, and your answer does not appear to have anything to do with the question...
Kim Gräsman