2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2014 Google LLC. All rights reserved.
|
2014-04-11 21:31:28 +00:00
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/base/closure_thread.h"
|
2014-04-11 21:31:28 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2014-04-11 21:31:28 +00:00
|
|
|
namespace media {
|
|
|
|
|
|
|
|
ClosureThread::ClosureThread(
|
|
|
|
const std::string& name_prefix,
|
|
|
|
const base::Closure& task)
|
|
|
|
: base::SimpleThread(name_prefix), task_(task) {}
|
|
|
|
|
|
|
|
ClosureThread::~ClosureThread() {
|
2014-04-19 01:48:41 +00:00
|
|
|
if (HasBeenStarted() && !HasBeenJoined())
|
2014-04-11 21:31:28 +00:00
|
|
|
Join();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClosureThread::Run() { task_.Run(); }
|
|
|
|
|
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|