thread/Thread: use BoundMethod

This commit is contained in:
Max Kellermann
2017-02-10 22:41:11 +01:00
parent 752ff12c37
commit 8649ea3d6f
18 changed files with 99 additions and 120 deletions

View File

@@ -51,7 +51,8 @@
AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin,
const ConfigBlock &block)
:plugin(_plugin)
:plugin(_plugin),
thread(BIND_THIS_METHOD(Task))
{
assert(plugin.finish != nullptr);
assert(plugin.open != nullptr);

View File

@@ -515,7 +515,6 @@ private:
* The OutputThread.
*/
void Task();
static void Task(void *arg);
};
/**

View File

@@ -396,7 +396,7 @@ AudioOutput::Pause()
pause = false;
}
inline void
void
AudioOutput::Task()
{
FormatThreadName("output:%s", name);
@@ -512,17 +512,10 @@ AudioOutput::Task()
}
}
void
AudioOutput::Task(void *arg)
{
AudioOutput *ao = (AudioOutput *)arg;
ao->Task();
}
void
AudioOutput::StartThread()
{
assert(command == Command::NONE);
thread.Start(Task, this);
thread.Start();
}