Commit 65c4e4a9 authored by Davis King's avatar Davis King

updated the docs

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402636
parent 67981f10
...@@ -607,6 +607,10 @@ ...@@ -607,6 +607,10 @@
<name>threaded_object</name> <name>threaded_object</name>
<link>dlib/threads/threaded_object_extension_abstract.h.html#threaded_object</link> <link>dlib/threads/threaded_object_extension_abstract.h.html#threaded_object</link>
</item> </item>
<item>
<name>thread_pool</name>
<link>dlib/threads/thread_pool_extension_abstract.h.html#thread_pool</link>
</item>
<item> <item>
<name>thread_function</name> <name>thread_function</name>
<link>dlib/threads/thread_function_extension_abstract.h.html#thread_function</link> <link>dlib/threads/thread_function_extension_abstract.h.html#thread_function</link>
...@@ -896,8 +900,7 @@ ...@@ -896,8 +900,7 @@
for creating multi-threaded programs. There are currently two implementations, one for creating multi-threaded programs. There are currently two implementations, one
for UNIX and another for any variant of MS Windows after Windows 95. Both provide for UNIX and another for any variant of MS Windows after Windows 95. Both provide
the exact same interface so programs written with them can be recompiled on either the exact same interface so programs written with them can be recompiled on either
platform without a problem. Both implementations also pool their threads so repeated platform without a problem.
calls to create_new_thread are nice and speedy :)
<p> <p>
You also probably want to take note of the <a href="other.html#pipe">pipe</a> object. You also probably want to take note of the <a href="other.html#pipe">pipe</a> object.
It provides an easy to use typesafe mechanism to send messages between threads. It provides an easy to use typesafe mechanism to send messages between threads.
...@@ -908,9 +911,6 @@ ...@@ -908,9 +911,6 @@
<example>threads_ex.cpp.html</example> <example>threads_ex.cpp.html</example>
<example>logger_ex_2.cpp.html</example> <example>logger_ex_2.cpp.html</example>
<example>pipe_ex.cpp.html</example> <example>pipe_ex.cpp.html</example>
<example>threaded_object_ex.cpp.html</example>
<example>multithreaded_object_ex.cpp.html</example>
<example>thread_function_ex.cpp.html</example>
</examples> </examples>
<implementations> <implementations>
...@@ -1047,6 +1047,25 @@ ...@@ -1047,6 +1047,25 @@
</extension> </extension>
<extension>
<name>thread_pool</name>
<spec_file>dlib/threads/thread_pool_extension_abstract.h</spec_file>
<description>
<p>
This object represents a fixed size group of threads which you can
submit tasks to and then wait for those tasks to be completed.
</p>
The implementation of this extension can be found
<a href="dlib/threads/thread_pool_extension.h.html">here</a>. It is
implemented such that no memory allocations occur after the thread pool
has been constructed.
</description>
<examples>
<example>thread_pool_ex.cpp.html</example>
</examples>
</extension>
<extension> <extension>
<name>multithreaded_object</name> <name>multithreaded_object</name>
<spec_file>dlib/threads/multithreaded_object_extension_abstract.h</spec_file> <spec_file>dlib/threads/multithreaded_object_extension_abstract.h</spec_file>
......
...@@ -83,13 +83,14 @@ ...@@ -83,13 +83,14 @@
<anchor>DLIB_THREAD_POOL_TIMEOUT</anchor> <anchor>DLIB_THREAD_POOL_TIMEOUT</anchor>
<h3>#define DLIB_THREAD_POOL_TIMEOUT &lt;time-in-milliseconds&gt;</h3> <h3>#define DLIB_THREAD_POOL_TIMEOUT &lt;time-in-milliseconds&gt;</h3>
<p> <p>
If you use the <a href="dlib/threads/threads_kernel_abstract.h.html#create_new_thread">create_new_thread</a> function If you use dlib to create your threads then you receive the benefit of the dlib dynamic thread pool (Note that the
to create your threads then you receive the benefit of the dlib thread pool. This pool enables the create_new_thread dlib::<a href="api.html#thread_pool">thread_pool</a> object is something else unrelated to this so don't confuse
function to spawn new threads very rapidly since it draws threads back out of its thread pool when the pool isn't the two). This pool
empty. enables dlib to spawn new threads very rapidly since it draws threads back out of its thread pool when
the pool isn't empty.
</p> </p>
<p> <p>
Thus, when a thread that was created by create_new_thread ends it actually goes back into the dlib thread pool Thus, when a thread that was created by dlib ends it actually goes back into the dlib thread pool
and waits DLIB_THREAD_POOL_TIMEOUT milliseconds before totally terminating and releasing its resources back and waits DLIB_THREAD_POOL_TIMEOUT milliseconds before totally terminating and releasing its resources back
to the operating system. The default timeout used by this library is 30,000 milliseconds (30 seconds). You to the operating system. The default timeout used by this library is 30,000 milliseconds (30 seconds). You
may however change this to whatever you like by defining DLIB_THREAD_POOL_TIMEOUT to some new value. may however change this to whatever you like by defining DLIB_THREAD_POOL_TIMEOUT to some new value.
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
<li><a href="api.html#thread_specific_data">Thread specific data</a></li> <li><a href="api.html#thread_specific_data">Thread specific data</a></li>
<li><a href="api.html#threaded_object">Threaded objects</a></li> <li><a href="api.html#threaded_object">Threaded objects</a></li>
<li><a href="api.html#thread_function">Threaded functions</a></li> <li><a href="api.html#thread_function">Threaded functions</a></li>
<li>A simple but powerful <a href="api.html#thread_pool">thread_pool</a></li>
</ul> </ul>
</li> </li>
......
...@@ -211,6 +211,10 @@ ...@@ -211,6 +211,10 @@
<name>Threaded_Object</name> <name>Threaded_Object</name>
<link>threaded_object_ex.cpp.html</link> <link>threaded_object_ex.cpp.html</link>
</item> </item>
<item>
<name>Thread_Pool</name>
<link>thread_pool_ex.cpp.html</link>
</item>
<item> <item>
<name>Thread_Function</name> <name>Thread_Function</name>
<link>thread_function_ex.cpp.html</link> <link>thread_function_ex.cpp.html</link>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<term link="api.html#thread_function" name="thread_function"/> <term link="api.html#thread_function" name="thread_function"/>
<term link="api.html#thread_specific_data" name="thread_specific_data"/> <term link="api.html#thread_specific_data" name="thread_specific_data"/>
<term link="api.html#threaded_object" name="threaded_object"/> <term link="api.html#threaded_object" name="threaded_object"/>
<term link="api.html#thread_pool" name="thread_pool"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment