Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
c75a0f7c
Commit
c75a0f7c
authored
Apr 25, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neighbor/smbclient: call Run() with locked mutex
parent
e740f8d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
SmbclientNeighborPlugin.cxx
src/neighbor/plugins/SmbclientNeighborPlugin.cxx
+10
-6
No files found.
src/neighbor/plugins/SmbclientNeighborPlugin.cxx
View file @
c75a0f7c
...
@@ -76,7 +76,11 @@ public:
...
@@ -76,7 +76,11 @@ public:
List
GetList
()
const
noexcept
override
;
List
GetList
()
const
noexcept
override
;
private
:
private
:
/**
* Caller must lock the mutex.
*/
void
Run
()
noexcept
;
void
Run
()
noexcept
;
void
ThreadFunc
()
noexcept
;
void
ThreadFunc
()
noexcept
;
};
};
...
@@ -189,9 +193,12 @@ FindBeforeServerByURI(NeighborExplorer::List::const_iterator prev,
...
@@ -189,9 +193,12 @@ FindBeforeServerByURI(NeighborExplorer::List::const_iterator prev,
inline
void
inline
void
SmbclientNeighborExplorer
::
Run
()
noexcept
SmbclientNeighborExplorer
::
Run
()
noexcept
{
{
List
found
=
DetectServers
()
,
lost
;
List
found
,
lost
;
mutex
.
lock
();
{
const
ScopeUnlock
unlock
(
mutex
);
found
=
DetectServers
();
}
const
auto
found_before_begin
=
found
.
before_begin
();
const
auto
found_before_begin
=
found
.
before_begin
();
const
auto
found_end
=
found
.
end
();
const
auto
found_end
=
found
.
end
();
...
@@ -216,7 +223,7 @@ SmbclientNeighborExplorer::Run() noexcept
...
@@ -216,7 +223,7 @@ SmbclientNeighborExplorer::Run() noexcept
i
!=
found_end
;
prev
=
i
,
i
=
std
::
next
(
prev
))
i
!=
found_end
;
prev
=
i
,
i
=
std
::
next
(
prev
))
list
.
push_front
(
*
i
);
list
.
push_front
(
*
i
);
mutex
.
unlock
(
);
const
ScopeUnlock
unlock
(
mutex
);
for
(
auto
&
i
:
lost
)
for
(
auto
&
i
:
lost
)
listener
.
LostNeighbor
(
i
);
listener
.
LostNeighbor
(
i
);
...
@@ -233,11 +240,8 @@ SmbclientNeighborExplorer::ThreadFunc() noexcept
...
@@ -233,11 +240,8 @@ SmbclientNeighborExplorer::ThreadFunc() noexcept
mutex
.
lock
();
mutex
.
lock
();
while
(
!
quit
)
{
while
(
!
quit
)
{
mutex
.
unlock
();
Run
();
Run
();
mutex
.
lock
();
if
(
quit
)
if
(
quit
)
break
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment