(Auto)update libjingle 67869540-> 67872893
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6243 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
b445f26f24
commit
75cb3dc5f2
@ -48,28 +48,29 @@ static void DoNothing(int unused) {}
|
||||
Console::Console(talk_base::Thread *thread, CallClient *client) :
|
||||
client_(client),
|
||||
client_thread_(thread),
|
||||
console_thread_(new talk_base::Thread()) {}
|
||||
stopped_(false) {}
|
||||
|
||||
Console::~Console() {
|
||||
Stop();
|
||||
}
|
||||
|
||||
void Console::Start() {
|
||||
if (!console_thread_) {
|
||||
if (stopped_) {
|
||||
// stdin was closed in Stop(), so we can't restart.
|
||||
LOG(LS_ERROR) << "Cannot re-start";
|
||||
return;
|
||||
}
|
||||
if (console_thread_->started()) {
|
||||
if (console_thread_) {
|
||||
LOG(LS_WARNING) << "Already started";
|
||||
return;
|
||||
}
|
||||
console_thread_.reset(new talk_base::Thread());
|
||||
console_thread_->Start();
|
||||
console_thread_->Post(this, MSG_START);
|
||||
}
|
||||
|
||||
void Console::Stop() {
|
||||
if (console_thread_ && console_thread_->started()) {
|
||||
if (console_thread_) {
|
||||
#ifdef WIN32
|
||||
CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
|
||||
#else
|
||||
@ -80,6 +81,7 @@ void Console::Stop() {
|
||||
#endif
|
||||
console_thread_->Stop();
|
||||
console_thread_.reset();
|
||||
stopped_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,3 +167,5 @@ void Console::OnMessage(talk_base::Message *msg) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ class Console : public talk_base::MessageHandler {
|
||||
CallClient *client_;
|
||||
talk_base::Thread *client_thread_;
|
||||
talk_base::scoped_ptr<talk_base::Thread> console_thread_;
|
||||
bool stopped_;
|
||||
};
|
||||
|
||||
#endif // TALK_EXAMPLES_CALL_CONSOLE_H_
|
||||
|
Loading…
Reference in New Issue
Block a user