DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
closure_thread.cc
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/closure_thread.h"
8 
9 namespace shaka {
10 namespace media {
11 
13  const std::string& name_prefix,
14  const base::Closure& task)
15  : base::SimpleThread(name_prefix), task_(task) {}
16 
18  if (HasBeenStarted() && !HasBeenJoined())
19  Join();
20 }
21 
22 void ClosureThread::Run() { task_.Run(); }
23 
24 } // namespace media
25 } // namespace shaka
void Run() override
SimpleThread implementation overrides.
ClosureThread(const std::string &name_prefix, const base::Closure &task)
~ClosureThread() override
The destructor calls Join automatically if it is not yet joined.