1 message in com.googlegroups.google-talk-openAutoThread?
FromSent OnAttachments
Amber08 May 2006 17:54 
Subject:AutoThread?
From:Amber (guxi@gmail.com)
Date:05/08/2006 05:54:59 PM
List:com.googlegroups.google-talk-open

In the libjingle library there is a AutoThread class which is a subclass of Thread, but I don't know what it does ,anybody tell me? And in my test application ,in the MFC main thread I created a Thread object , and called the object's start and stop method ,but the main thread just exits execution without waiting for the thread to return ,I wonder why.

Code like this: class ThreadA :public Thread{ ... };

ThreadA a; a.start();

a.Post(/*handler*/,/*msg id*/,/*msg data*/); a.Post(/*handler*/,/*msg id*/,/*msg data*/);

.....

a.Post(/*handler*/,/*msg id*/,/*msg data*/); a.Post(/*handler*/,/*msg id*/,/*msg data*/);

// a has a lot of work to do ,so we must wait.

a.Stop();

//but the a.Stop method returns immediately,and there is a application crash \ // because the worker thread references some data in object a ,while the a object // has been clened because it is created in the stack.