diff options
author | Max Kellermann <max@musicpd.org> | 2017-02-10 22:41:11 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-02-10 22:46:09 +0100 |
commit | 781487c4ddf3ea08d31f7889e4b1e909aa3717db (patch) | |
tree | 3fac90d1ef16a6604c13086abd80660a38a44c55 /src/neighbor | |
parent | 5ba5bc8ba131de8a6c39139827e31c78f88c2ccc (diff) |
thread/Thread: use BoundMethod
Diffstat (limited to 'src/neighbor')
-rw-r--r-- | src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx index 2ccfcc1e2..3b7a8b069 100644 --- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx +++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx @@ -69,7 +69,8 @@ class SmbclientNeighborExplorer final : public NeighborExplorer { public: SmbclientNeighborExplorer(NeighborListener &_listener) - :NeighborExplorer(_listener) {} + :NeighborExplorer(_listener), + thread(BIND_THIS_METHOD(ThreadFunc)) {} /* virtual methods from class NeighborExplorer */ void Open() override; @@ -79,14 +80,13 @@ public: private: void Run(); void ThreadFunc(); - static void ThreadFunc(void *ctx); }; void SmbclientNeighborExplorer::Open() { quit = false; - thread.Start(ThreadFunc, this); + thread.Start(); } void @@ -239,6 +239,8 @@ SmbclientNeighborExplorer::Run() inline void SmbclientNeighborExplorer::ThreadFunc() { + SetThreadName("smbclient"); + mutex.lock(); while (!quit) { @@ -257,15 +259,6 @@ SmbclientNeighborExplorer::ThreadFunc() mutex.unlock(); } -void -SmbclientNeighborExplorer::ThreadFunc(void *ctx) -{ - SetThreadName("smbclient"); - - SmbclientNeighborExplorer &e = *(SmbclientNeighborExplorer *)ctx; - e.ThreadFunc(); -} - static NeighborExplorer * smbclient_neighbor_create(gcc_unused EventLoop &loop, NeighborListener &listener, |