Skip to content

Commit

Permalink
aligned allocation of vectors (#15)
Browse files Browse the repository at this point in the history
* aligned allocator for vectors

* custom new/delete for ThreadPool

* comments

* finalize

* allow throwing ThreadPool::new
  • Loading branch information
tnagler authored Jan 27, 2022
1 parent df510a6 commit ea78847
Show file tree
Hide file tree
Showing 73 changed files with 2,441 additions and 1,266 deletions.
2 changes: 1 addition & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "quickpool"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.3.0
PROJECT_NUMBER = 1.4.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion docs/annotated.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down
4 changes: 3 additions & 1 deletion docs/classquickpool_1_1ThreadPool-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down Expand Up @@ -78,6 +78,8 @@
<tr><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html#ac0f882945e639b1092e543b11cf3abe8">done</a>() const</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html#a9fa5b73a745b2382fecfadd2afb34735">get_active_threads</a>() const</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html#ab5daa930caa3724dac002ac2dd3d3180">global_instance</a>()</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html#a6c1369433f01eb78516e809a98aa1fb6">operator delete</a>(void *ptr)</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html#a27bc3249d258543c450f0e98492be310">operator new</a>(size_t count) noexcept</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>operator=</b>(const ThreadPool &amp;)=delete (defined in <a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a>)</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>operator=</b>(ThreadPool &amp;&amp;other)=delete (defined in <a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a>)</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html#acb9d7efe2053b8d961ed98bcc2cf2618">parallel_for</a>(int begin, int end, UnaryFunction f)</td><td class="entry"><a class="el" href="classquickpool_1_1ThreadPool.html">quickpool::ThreadPool</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
Expand Down
26 changes: 17 additions & 9 deletions docs/classquickpool_1_1ThreadPool.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down Expand Up @@ -135,11 +135,19 @@
static <a class="el" href="classquickpool_1_1ThreadPool.html">ThreadPool</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classquickpool_1_1ThreadPool.html#ab5daa930caa3724dac002ac2dd3d3180">global_instance</a> ()</td></tr>
<tr class="memdesc:ab5daa930caa3724dac002ac2dd3d3180"><td class="mdescLeft">&#160;</td><td class="mdescRight">returns a reference to the global thread pool instance. <br /></td></tr>
<tr class="separator:ab5daa930caa3724dac002ac2dd3d3180"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a27bc3249d258543c450f0e98492be310"><td class="memItemLeft" align="right" valign="top"><a id="a27bc3249d258543c450f0e98492be310"></a>
static void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classquickpool_1_1ThreadPool.html#a27bc3249d258543c450f0e98492be310">operator new</a> (size_t count) noexcept</td></tr>
<tr class="memdesc:a27bc3249d258543c450f0e98492be310"><td class="mdescLeft">&#160;</td><td class="mdescRight">allocator respecting memory alignment. <br /></td></tr>
<tr class="separator:a27bc3249d258543c450f0e98492be310"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c1369433f01eb78516e809a98aa1fb6"><td class="memItemLeft" align="right" valign="top"><a id="a6c1369433f01eb78516e809a98aa1fb6"></a>
static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classquickpool_1_1ThreadPool.html#a6c1369433f01eb78516e809a98aa1fb6">operator delete</a> (void *ptr)</td></tr>
<tr class="memdesc:a6c1369433f01eb78516e809a98aa1fb6"><td class="mdescLeft">&#160;</td><td class="mdescRight">deallocator respecting memory alignment. <br /></td></tr>
<tr class="separator:a6c1369433f01eb78516e809a98aa1fb6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A work stealing thread pool. </p>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00678">678</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00756">756</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ace792be7b69bb4e18c1770d898e84303"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace792be7b69bb4e18c1770d898e84303">&#9670;&nbsp;</a></span>ThreadPool()</h2>
Expand Down Expand Up @@ -173,7 +181,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ace792be7b69bb4e18c1770d8
</dd>
</dl>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00684">684</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00762">762</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>

</div>
</div>
Expand Down Expand Up @@ -225,7 +233,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#af803164106b0c9181e01eb59
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <code>std::future</code> for the task. Call <code>future.get()</code> to retrieve the results at a later point in time (blocking). </dd></dl>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00760">760</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00838">838</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>

</div>
</div>
Expand Down Expand Up @@ -282,7 +290,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#acb9d7efe2053b8d961ed98bc
</dd>
</dl>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00781">781</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00859">859</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>

</div>
</div>
Expand Down Expand Up @@ -332,7 +340,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ad08862259cb77c023523789c
</dd>
</dl>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00803">803</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00881">881</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>

</div>
</div>
Expand Down Expand Up @@ -381,7 +389,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#a3a79d3a078643e271b238ee1
</dd>
</dl>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00746">746</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00824">824</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>

</div>
</div>
Expand Down Expand Up @@ -417,7 +425,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#aaed4dbfa25b36013a801d697
</dd>
</dl>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00718">718</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00796">796</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>

</div>
</div>
Expand Down Expand Up @@ -453,7 +461,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#a118c926c7a49a5ac952291e2
</dd>
</dl>

<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00814">814</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="quickpool_8hpp_source.html#l00892">892</a> of file <a class="el" href="quickpool_8hpp_source.html">quickpool.hpp</a>.</p>

</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down
8 changes: 7 additions & 1 deletion docs/functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down Expand Up @@ -76,6 +76,12 @@
<li>global_instance()
: <a class="el" href="classquickpool_1_1ThreadPool.html#ab5daa930caa3724dac002ac2dd3d3180">quickpool::ThreadPool</a>
</li>
<li>operator delete()
: <a class="el" href="classquickpool_1_1ThreadPool.html#a6c1369433f01eb78516e809a98aa1fb6">quickpool::ThreadPool</a>
</li>
<li>operator new()
: <a class="el" href="classquickpool_1_1ThreadPool.html#a27bc3249d258543c450f0e98492be310">quickpool::ThreadPool</a>
</li>
<li>parallel_for()
: <a class="el" href="classquickpool_1_1ThreadPool.html#acb9d7efe2053b8d961ed98bcc2cf2618">quickpool::ThreadPool</a>
</li>
Expand Down
8 changes: 7 additions & 1 deletion docs/functions_func.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down Expand Up @@ -76,6 +76,12 @@
<li>global_instance()
: <a class="el" href="classquickpool_1_1ThreadPool.html#ab5daa930caa3724dac002ac2dd3d3180">quickpool::ThreadPool</a>
</li>
<li>operator delete()
: <a class="el" href="classquickpool_1_1ThreadPool.html#a6c1369433f01eb78516e809a98aa1fb6">quickpool::ThreadPool</a>
</li>
<li>operator new()
: <a class="el" href="classquickpool_1_1ThreadPool.html#a27bc3249d258543c450f0e98492be310">quickpool::ThreadPool</a>
</li>
<li>parallel_for()
: <a class="el" href="classquickpool_1_1ThreadPool.html#acb9d7efe2053b8d961ed98bcc2cf2618">quickpool::ThreadPool</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion docs/graph_legend.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">quickpool
&#160;<span id="projectnumber">1.3.0</span>
&#160;<span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
Expand Down
90 changes: 90 additions & 0 deletions docs/hierarchy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>quickpool: Class Hierarchy</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">quickpool
&#160;<span id="projectnumber">1.3.0</span>
</div>
<div id="projectbrief">An easy-to-use, header-only work stealing thread pool in C++11</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- 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 class="header">
<div class="headertitle">
<div class="title">Class Hierarchy</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock">
<p><a href="inherits.html">Go to the graphical class hierarchy</a></p>
This inheritance list is sorted roughly, but not completely, alphabetically:</div><div class="directory">
<div class="levels">[detail level <span onclick="javascript:toggleLevel(1);">1</span><span onclick="javascript:toggleLevel(2);">2</span>]</div><table class="directory">
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structquickpool_1_1padding__impl_1_1empty__struct.html" target="_self">quickpool::padding_impl::empty_struct</a></td><td class="desc"></td></tr>
<tr id="row_1_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structquickpool_1_1padding__impl_1_1padding__bytes.html" target="_self">quickpool::padding_impl::padding_bytes&lt; T, Align &gt;</a></td><td class="desc"></td></tr>
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classquickpool_1_1ThreadPool.html" target="_self">quickpool::ThreadPool</a></td><td class="desc">A work stealing thread pool </td></tr>
<tr id="row_3_"><td class="entry"><span style="width:0px;display:inline-block;">&#160;</span><span id="arr_3_" class="arrow" onclick="toggleFolder('3_')">&#9660;</span><span class="icona"><span class="icon">C</span></span><b>type</b></td><td class="desc"></td></tr>
<tr id="row_3_0_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structquickpool_1_1padding__impl_1_1padding.html" target="_self">quickpool::padding_impl::padding&lt; T, 64 &gt;</a></td><td class="desc"></td></tr>
<tr id="row_3_1_"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structquickpool_1_1padding__impl_1_1padding.html" target="_self">quickpool::padding_impl::padding&lt; T, Align &gt;</a></td><td class="desc"></td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
Loading

0 comments on commit ea78847

Please sign in to comment.