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
9f316e11
Commit
9f316e11
authored
Jan 14, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp/WorkQueue: remove unused method waitIdle()
Contrary to setTerminateAndWait()'s documentation, the method does wait for worker threads to exit via pthread_join().
parent
c6d8f6da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
42 deletions
+0
-42
WorkQueue.hxx
src/db/upnp/WorkQueue.hxx
+0
-42
No files found.
src/db/upnp/WorkQueue.hxx
View file @
9f316e11
...
@@ -154,50 +154,8 @@ public:
...
@@ -154,50 +154,8 @@ public:
return
true
;
return
true
;
}
}
/**
* Wait until the queue is inactive. Called from client.
*
* Waits until the task queue is empty and the workers are all
* back sleeping. Used by the client to wait for all current work
* to be completed, when it needs to perform work that couldn't be
* done in parallel with the worker's tasks, or before shutting
* down. Work can be resumed after calling this. Note that the
* only thread which can call it safely is the client just above
* (which can control the task flow), else there could be
* tasks in the intermediate queues.
* To rephrase: there is no warranty on return that the queue is actually
* idle EXCEPT if the caller knows that no jobs are still being created.
* It would be possible to transform this into a safe call if some kind
* of suspend condition was set on the queue by waitIdle(), to be reset by
* some kind of "resume" call. Not currently the case.
*/
bool
waitIdle
()
{
const
ScopeLock
protect
(
mutex
);
if
(
!
IsOK
())
{
LOGERR
((
"WorkQueue::waitIdle:%s: not ok or can't lock
\n
"
,
name
.
c_str
()));
return
false
;
}
// We're done when the queue is empty AND all workers are back
// waiting for a task.
while
(
IsOK
()
&&
(
queue
.
size
()
>
0
||
n_workers_waiting
!=
n_threads
))
{
n_clients_waiting
++
;
client_cond
.
wait
(
mutex
);
n_clients_waiting
--
;
}
return
IsOK
();
}
/** Tell the workers to exit, and wait for them.
/** Tell the workers to exit, and wait for them.
*
* Does not bother about tasks possibly remaining on the queue, so
* should be called after waitIdle() for an orderly shutdown.
*/
*/
void
setTerminateAndWait
()
void
setTerminateAndWait
()
{
{
...
...
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