/usr/share/doc/libjuce/apiref/classThreadPool.html is in libjuce-doc 4.3.0~repack-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>JUCE: ThreadPool Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">JUCE
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="classThreadPool-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">ThreadPool Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A set of threads that will run a list of jobs.
<a href="classThreadPool.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool_1_1JobSelector.html">JobSelector</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">A callback class used when you need to select which <a class="el" href="classThreadPoolJob.html" title="A task that is executed by a ThreadPool object. ">ThreadPoolJob</a> objects are suitable for some kind of operation. <a href="classThreadPool_1_1JobSelector.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae55fe4a480fa7144d8e87bbd0a917b14"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#ae55fe4a480fa7144d8e87bbd0a917b14">ThreadPool</a> (int numberOfThreads, size_t threadStackSize=0)</td></tr>
<tr class="memdesc:ae55fe4a480fa7144d8e87bbd0a917b14"><td class="mdescLeft"> </td><td class="mdescRight">Creates a thread pool. <a href="#ae55fe4a480fa7144d8e87bbd0a917b14">More...</a><br /></td></tr>
<tr class="separator:ae55fe4a480fa7144d8e87bbd0a917b14"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3225e86aa7835545b3f6c2c8d363d5e5"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a3225e86aa7835545b3f6c2c8d363d5e5">ThreadPool</a> ()</td></tr>
<tr class="memdesc:a3225e86aa7835545b3f6c2c8d363d5e5"><td class="mdescLeft"> </td><td class="mdescRight">Creates a thread pool with one thread per CPU core. <a href="#a3225e86aa7835545b3f6c2c8d363d5e5">More...</a><br /></td></tr>
<tr class="separator:a3225e86aa7835545b3f6c2c8d363d5e5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a44d3d2ab618970605e684efc216655eb"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a44d3d2ab618970605e684efc216655eb">~ThreadPool</a> ()</td></tr>
<tr class="memdesc:a44d3d2ab618970605e684efc216655eb"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a44d3d2ab618970605e684efc216655eb">More...</a><br /></td></tr>
<tr class="separator:a44d3d2ab618970605e684efc216655eb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad46e866e912868092fff107dc555443b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#ad46e866e912868092fff107dc555443b">addJob</a> (<a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> *job, bool deleteJobWhenFinished)</td></tr>
<tr class="memdesc:ad46e866e912868092fff107dc555443b"><td class="mdescLeft"> </td><td class="mdescRight">Adds a job to the queue. <a href="#ad46e866e912868092fff107dc555443b">More...</a><br /></td></tr>
<tr class="separator:ad46e866e912868092fff107dc555443b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a10da7494ab922d7157a5929d0689bf54"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a10da7494ab922d7157a5929d0689bf54">removeJob</a> (<a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> *job, bool interruptIfRunning, int timeOutMilliseconds)</td></tr>
<tr class="memdesc:a10da7494ab922d7157a5929d0689bf54"><td class="mdescLeft"> </td><td class="mdescRight">Tries to remove a job from the pool. <a href="#a10da7494ab922d7157a5929d0689bf54">More...</a><br /></td></tr>
<tr class="separator:a10da7494ab922d7157a5929d0689bf54"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a621253ea8de07a09a6c18238f8d33ced"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a621253ea8de07a09a6c18238f8d33ced">removeAllJobs</a> (bool interruptRunningJobs, int timeOutMilliseconds, <a class="el" href="classThreadPool_1_1JobSelector.html">JobSelector</a> *selectedJobsToRemove=nullptr)</td></tr>
<tr class="memdesc:a621253ea8de07a09a6c18238f8d33ced"><td class="mdescLeft"> </td><td class="mdescRight">Tries to remove all jobs from the pool. <a href="#a621253ea8de07a09a6c18238f8d33ced">More...</a><br /></td></tr>
<tr class="separator:a621253ea8de07a09a6c18238f8d33ced"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac0c91fee64c8b6c961190f397d0b4f69"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#ac0c91fee64c8b6c961190f397d0b4f69">getNumJobs</a> () const</td></tr>
<tr class="memdesc:ac0c91fee64c8b6c961190f397d0b4f69"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of jobs currently running or queued. <a href="#ac0c91fee64c8b6c961190f397d0b4f69">More...</a><br /></td></tr>
<tr class="separator:ac0c91fee64c8b6c961190f397d0b4f69"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1352a1ce81d92cd1e670da89c6d8fb42"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a1352a1ce81d92cd1e670da89c6d8fb42">getNumThreads</a> () const</td></tr>
<tr class="memdesc:a1352a1ce81d92cd1e670da89c6d8fb42"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of threads assigned to this thread pool. <a href="#a1352a1ce81d92cd1e670da89c6d8fb42">More...</a><br /></td></tr>
<tr class="separator:a1352a1ce81d92cd1e670da89c6d8fb42"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aae498e25c41043d677deb2888fcbc1ad"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#aae498e25c41043d677deb2888fcbc1ad">getJob</a> (int index) const</td></tr>
<tr class="memdesc:aae498e25c41043d677deb2888fcbc1ad"><td class="mdescLeft"> </td><td class="mdescRight">Returns one of the jobs in the queue. <a href="#aae498e25c41043d677deb2888fcbc1ad">More...</a><br /></td></tr>
<tr class="separator:aae498e25c41043d677deb2888fcbc1ad"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a64236b1e42ce7b397cbb4b426eb48bd7"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a64236b1e42ce7b397cbb4b426eb48bd7">contains</a> (const <a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> *job) const</td></tr>
<tr class="memdesc:a64236b1e42ce7b397cbb4b426eb48bd7"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the given job is currently queued or running. <a href="#a64236b1e42ce7b397cbb4b426eb48bd7">More...</a><br /></td></tr>
<tr class="separator:a64236b1e42ce7b397cbb4b426eb48bd7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab77355fc06c19ce0bea32a408d119405"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#ab77355fc06c19ce0bea32a408d119405">isJobRunning</a> (const <a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> *job) const</td></tr>
<tr class="memdesc:ab77355fc06c19ce0bea32a408d119405"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the given job is currently being run by a thread. <a href="#ab77355fc06c19ce0bea32a408d119405">More...</a><br /></td></tr>
<tr class="separator:ab77355fc06c19ce0bea32a408d119405"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afb20e0b644a6871a4de2de7f73aa3ee5"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#afb20e0b644a6871a4de2de7f73aa3ee5">waitForJobToFinish</a> (const <a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> *job, int timeOutMilliseconds) const</td></tr>
<tr class="memdesc:afb20e0b644a6871a4de2de7f73aa3ee5"><td class="mdescLeft"> </td><td class="mdescRight">Waits until a job has finished running and has been removed from the pool. <a href="#afb20e0b644a6871a4de2de7f73aa3ee5">More...</a><br /></td></tr>
<tr class="separator:afb20e0b644a6871a4de2de7f73aa3ee5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a017602a7ad54d6293d6c0c6a67cc36e5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classStringArray.html">StringArray</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a017602a7ad54d6293d6c0c6a67cc36e5">getNamesOfAllJobs</a> (bool onlyReturnActiveJobs) const</td></tr>
<tr class="memdesc:a017602a7ad54d6293d6c0c6a67cc36e5"><td class="mdescLeft"> </td><td class="mdescRight">Returns a list of the names of all the jobs currently running or queued. <a href="#a017602a7ad54d6293d6c0c6a67cc36e5">More...</a><br /></td></tr>
<tr class="separator:a017602a7ad54d6293d6c0c6a67cc36e5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3f69128c07cb778cf6ab981b1b9be650"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPool.html#a3f69128c07cb778cf6ab981b1b9be650">setThreadPriorities</a> (int newPriority)</td></tr>
<tr class="memdesc:a3f69128c07cb778cf6ab981b1b9be650"><td class="mdescLeft"> </td><td class="mdescRight">Changes the priority of all the threads. <a href="#a3f69128c07cb778cf6ab981b1b9be650">More...</a><br /></td></tr>
<tr class="separator:a3f69128c07cb778cf6ab981b1b9be650"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A set of threads that will run a list of jobs. </p>
<p>When a <a class="el" href="classThreadPoolJob.html" title="A task that is executed by a ThreadPool object. ">ThreadPoolJob</a> object is added to the <a class="el" href="classThreadPool.html" title="A set of threads that will run a list of jobs. ">ThreadPool</a>'s list, its runJob() method will be called by the next pooled thread that becomes free.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classThreadPoolJob.html" title="A task that is executed by a ThreadPool object. ">ThreadPoolJob</a>, <a class="el" href="classThread.html" title="Encapsulates a thread. ">Thread</a> </dd></dl>
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="ae55fe4a480fa7144d8e87bbd0a917b14"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae55fe4a480fa7144d8e87bbd0a917b14">§ </a></span>ThreadPool() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ThreadPool::ThreadPool </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>numberOfThreads</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>threadStackSize</em> = <code>0</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a thread pool. </p>
<p>Once you've created a pool, you can give it some jobs by calling <a class="el" href="classThreadPool.html#ad46e866e912868092fff107dc555443b" title="Adds a job to the queue. ">addJob()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">numberOfThreads</td><td>the number of threads to run. These will be started immediately, and will run until the pool is deleted. </td></tr>
<tr><td class="paramname">threadStackSize</td><td>the size of the stack of each thread. If this value is zero then the default stack size of the OS will be used. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a3225e86aa7835545b3f6c2c8d363d5e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3225e86aa7835545b3f6c2c8d363d5e5">§ </a></span>ThreadPool() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ThreadPool::ThreadPool </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a thread pool with one thread per CPU core. </p>
<p>Once you've created a pool, you can give it some jobs by calling <a class="el" href="classThreadPool.html#ad46e866e912868092fff107dc555443b" title="Adds a job to the queue. ">addJob()</a>. If you want to specify the number of threads, use the other constructor; this one creates a pool which has one thread for each CPU core. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="classSystemStats.html#a2fa9257a60a26848174b2b8bd6cbb970" title="Returns the number of CPU cores. ">SystemStats::getNumCpus()</a> </dd></dl>
</div>
</div>
<a id="a44d3d2ab618970605e684efc216655eb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a44d3d2ab618970605e684efc216655eb">§ </a></span>~ThreadPool()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ThreadPool::~ThreadPool </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
<p>This will attempt to remove all the jobs before deleting, but if you want to specify a timeout, you should call <a class="el" href="classThreadPool.html#a621253ea8de07a09a6c18238f8d33ced" title="Tries to remove all jobs from the pool. ">removeAllJobs()</a> explicitly before deleting the pool. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ad46e866e912868092fff107dc555443b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad46e866e912868092fff107dc555443b">§ </a></span>addJob()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ThreadPool::addJob </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> * </td>
<td class="paramname"><em>job</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>deleteJobWhenFinished</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds a job to the queue. </p>
<p>Once a job has been added, then the next time a thread is free, it will run the job's <a class="el" href="classThreadPoolJob.html#aec49c01680e563257c79088dc87bc0d9" title="Peforms the actual work that this job needs to do. ">ThreadPoolJob::runJob()</a> method. Depending on the return value of the runJob() method, the pool will either remove the job from the pool or add it to the back of the queue to be run again.</p>
<p>If deleteJobWhenFinished is true, then the job object will be owned and deleted by the pool when not needed - if you do this, make sure that your object's destructor is thread-safe.</p>
<p>If deleteJobWhenFinished is false, the pointer will be used but not deleted, and the caller is responsible for making sure the object is not deleted before it has been removed from the pool. </p>
</div>
</div>
<a id="a10da7494ab922d7157a5929d0689bf54"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a10da7494ab922d7157a5929d0689bf54">§ </a></span>removeJob()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ThreadPool::removeJob </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> * </td>
<td class="paramname"><em>job</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>interruptIfRunning</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>timeOutMilliseconds</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Tries to remove a job from the pool. </p>
<p>If the job isn't yet running, this will simply remove it. If it is running, it will wait for it to finish.</p>
<p>If the timeout period expires before the job finishes running, then the job will be left in the pool and this will return false. It returns true if the job is successfully stopped and removed.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">job</td><td>the job to remove </td></tr>
<tr><td class="paramname">interruptIfRunning</td><td>if true, then if the job is currently busy, its <a class="el" href="classThreadPoolJob.html#acf58a7de172ae74d6ebb4a9fb59ed4d3" title="Calling this will cause the shouldExit() method to return true, and the job should (if it's been impl...">ThreadPoolJob::signalJobShouldExit()</a> method will be called to try to interrupt it. If false, then if the job will be allowed to run until it stops normally (or the timeout expires) </td></tr>
<tr><td class="paramname">timeOutMilliseconds</td><td>the length of time this method should wait for the job to finish before giving up and returning false </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a621253ea8de07a09a6c18238f8d33ced"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a621253ea8de07a09a6c18238f8d33ced">§ </a></span>removeAllJobs()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ThreadPool::removeAllJobs </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"><em>interruptRunningJobs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>timeOutMilliseconds</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classThreadPool_1_1JobSelector.html">JobSelector</a> * </td>
<td class="paramname"><em>selectedJobsToRemove</em> = <code>nullptr</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Tries to remove all jobs from the pool. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">interruptRunningJobs</td><td>if true, then all running jobs will have their <a class="el" href="classThreadPoolJob.html#acf58a7de172ae74d6ebb4a9fb59ed4d3" title="Calling this will cause the shouldExit() method to return true, and the job should (if it's been impl...">ThreadPoolJob::signalJobShouldExit()</a> methods called to try to interrupt them </td></tr>
<tr><td class="paramname">timeOutMilliseconds</td><td>the length of time this method should wait for all the jobs to finish before giving up and returning false </td></tr>
<tr><td class="paramname">selectedJobsToRemove</td><td>if this is not a nullptr, the <a class="el" href="classThreadPool_1_1JobSelector.html" title="A callback class used when you need to select which ThreadPoolJob objects are suitable for some kind ...">JobSelector</a> object is asked to decide which jobs should be removed. If it is a nullptr, all jobs are removed </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if all jobs are successfully stopped and removed; false if the timeout period expires while waiting for one or more jobs to stop </dd></dl>
</div>
</div>
<a id="ac0c91fee64c8b6c961190f397d0b4f69"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac0c91fee64c8b6c961190f397d0b4f69">§ </a></span>getNumJobs()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int ThreadPool::getNumJobs </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of jobs currently running or queued. </p>
</div>
</div>
<a id="a1352a1ce81d92cd1e670da89c6d8fb42"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1352a1ce81d92cd1e670da89c6d8fb42">§ </a></span>getNumThreads()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int ThreadPool::getNumThreads </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of threads assigned to this thread pool. </p>
</div>
</div>
<a id="aae498e25c41043d677deb2888fcbc1ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aae498e25c41043d677deb2888fcbc1ad">§ </a></span>getJob()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a>* ThreadPool::getJob </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>index</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns one of the jobs in the queue. </p>
<p>Note that this can be a very volatile list as jobs might be continuously getting shifted around in the list, and this method may return nullptr if the index is currently out-of-range. </p>
</div>
</div>
<a id="a64236b1e42ce7b397cbb4b426eb48bd7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a64236b1e42ce7b397cbb4b426eb48bd7">§ </a></span>contains()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ThreadPool::contains </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> * </td>
<td class="paramname"><em>job</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns true if the given job is currently queued or running. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classThreadPool.html#ab77355fc06c19ce0bea32a408d119405" title="Returns true if the given job is currently being run by a thread. ">isJobRunning()</a> </dd></dl>
</div>
</div>
<a id="ab77355fc06c19ce0bea32a408d119405"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab77355fc06c19ce0bea32a408d119405">§ </a></span>isJobRunning()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ThreadPool::isJobRunning </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> * </td>
<td class="paramname"><em>job</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns true if the given job is currently being run by a thread. </p>
</div>
</div>
<a id="afb20e0b644a6871a4de2de7f73aa3ee5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afb20e0b644a6871a4de2de7f73aa3ee5">§ </a></span>waitForJobToFinish()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ThreadPool::waitForJobToFinish </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classThreadPoolJob.html">ThreadPoolJob</a> * </td>
<td class="paramname"><em>job</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>timeOutMilliseconds</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Waits until a job has finished running and has been removed from the pool. </p>
<p>This will wait until the job is no longer in the pool - i.e. until its runJob() method returns <a class="el" href="classThreadPoolJob.html#a534c077f3c60168d88555ade062420b3a390a063ef5f8b769a682f1daefc64e72" title="indicates that the job has finished and can be removed from the pool. ">ThreadPoolJob::jobHasFinished</a>.</p>
<p>If the timeout period expires before the job finishes, this will return false; it returns true if the job has finished successfully. </p>
</div>
</div>
<a id="a017602a7ad54d6293d6c0c6a67cc36e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a017602a7ad54d6293d6c0c6a67cc36e5">§ </a></span>getNamesOfAllJobs()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classStringArray.html">StringArray</a> ThreadPool::getNamesOfAllJobs </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"><em>onlyReturnActiveJobs</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a list of the names of all the jobs currently running or queued. </p>
<p>If onlyReturnActiveJobs is true, only the ones currently running are returned. </p>
</div>
</div>
<a id="a3f69128c07cb778cf6ab981b1b9be650"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3f69128c07cb778cf6ab981b1b9be650">§ </a></span>setThreadPriorities()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool ThreadPool::setThreadPriorities </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>newPriority</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Changes the priority of all the threads. </p>
<p>This will call <a class="el" href="classThread.html#a0975d9ee9f403f5f82287fcce4a7168f" title="Changes the thread's priority. ">Thread::setPriority()</a> for each thread in the pool. May return false if for some reason the priority can't be changed. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="juce__ThreadPool_8h.html">juce_ThreadPool.h</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/>
<address class="footer"><small>All content © ROLI Ltd.</small></address><br/>
</body>
</html>
|