<!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> <title>Class Poco::TaskManager</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="language" content="en"/> <meta name="date" content="2009-11-24"/> <meta name="generator" content="PocoDoc"/> <link rel="stylesheet" href="css/styles.css" type="text/css"/> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0"> <div class="header"> <h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1> <h1 class="symbol">class TaskManager</h1> </div> <div class="body"> <p> <b>Library:</b> Foundation<br /> <b>Package:</b> Tasks<br /> <b>Header:</b> Poco/TaskManager.h</p> <h2>Description</h2> <div class="description"> <p>The <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a> manages a collection of tasks and monitors their lifetime. </p> <p>A <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a> has a built-in <a href="Poco.NotificationCenter.html" title="class Poco::NotificationCenter">NotificationCenter</a> that is used to send out notifications on task progress and task states. See the <a href="Poco.TaskNotification.html" title="class Poco::TaskNotification">TaskNotification</a> class and its subclasses for the various events that result in a notification. To keep the number of notifications small, a <a href="Poco.TaskProgressNotification.html" title="class Poco::TaskProgressNotification">TaskProgressNotification</a> will only be sent out once in 100 milliseconds. </p> </div> <h2>Member Summary</h2> <p><b>Member Functions: </b><a href="Poco.TaskManager.html#10602" title="Poco::TaskManager::addObserver()">addObserver</a>, <a href="Poco.TaskManager.html#10598" title="Poco::TaskManager::cancelAll()">cancelAll</a>, <a href="Poco.TaskManager.html#10601" title="Poco::TaskManager::count()">count</a>, <a href="Poco.TaskManager.html#10599" title="Poco::TaskManager::joinAll()">joinAll</a>, <a href="Poco.TaskManager.html#10607" title="Poco::TaskManager::postNotification()">postNotification</a>, <a href="Poco.TaskManager.html#10604" title="Poco::TaskManager::removeObserver()">removeObserver</a>, <a href="Poco.TaskManager.html#10596" title="Poco::TaskManager::start()">start</a>, <a href="Poco.TaskManager.html#10614" title="Poco::TaskManager::taskCancelled()">taskCancelled</a>, <a href="Poco.TaskManager.html#10618" title="Poco::TaskManager::taskFailed()">taskFailed</a>, <a href="Poco.TaskManager.html#10616" title="Poco::TaskManager::taskFinished()">taskFinished</a>, <a href="Poco.TaskManager.html#10600" title="Poco::TaskManager::taskList()">taskList</a>, <a href="Poco.TaskManager.html#10611" title="Poco::TaskManager::taskProgress()">taskProgress</a>, <a href="Poco.TaskManager.html#10609" title="Poco::TaskManager::taskStarted()">taskStarted</a></p> <h2>Types</h2> <h3><a name="10591">TaskList</a></h3> <p class="decl">typedef std::list < <a href="Poco.TaskManager.html#10590" title="Poco::TaskManager::TaskPtr">TaskPtr</a> > <a href="Poco.TaskManager.html#10591" title="Poco::TaskManager::TaskList">TaskList</a>;</p> <div class="description"> <p></p> </div> <h3><a name="10590">TaskPtr</a></h3> <p class="decl">typedef <a href="Poco.AutoPtr.html" title="class Poco::AutoPtr">AutoPtr</a> < <a href="Poco.Task.html" title="class Poco::Task">Task</a> > <a href="Poco.TaskManager.html#10590" title="Poco::TaskManager::TaskPtr">TaskPtr</a>;</p> <div class="description"> <p></p> </div> <h2>Constructors</h2> <h3><a name="10592">TaskManager</a></h3> <p class="decl"><a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a>();</p> <div class="description"> <p>Creates the <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a>, using the default <a href="Poco.ThreadPool.html" title="class Poco::ThreadPool">ThreadPool</a>. </p> </div> <h3><a name="10593">TaskManager</a></h3> <p class="decl"><a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a>(<br /> <a href="Poco.ThreadPool.html" title="class Poco::ThreadPool">ThreadPool</a> & pool<br />);</p> <div class="description"> <p>Creates the <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a>, using the given <a href="Poco.ThreadPool.html" title="class Poco::ThreadPool">ThreadPool</a>. </p> </div> <h2>Destructor</h2> <h3><a name="10595">~TaskManager</a></h3> <p class="decl">~<a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a>();</p> <div class="description"> <p>Destroys the <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a>. </p> </div> <h2>Member Functions</h2> <h3><a name="10602">addObserver</a></h3> <p class="decl">void addObserver(<br /> const <a href="Poco.AbstractObserver.html" title="class Poco::AbstractObserver">AbstractObserver</a> & observer<br />);</p> <div class="description"> <p>Registers an observer with the <a href="Poco.NotificationCenter.html" title="class Poco::NotificationCenter">NotificationCenter</a>. Usage: </p> <pre>Observer<MyClass, MyNotification> obs(*this, &MyClass::handleNotification); notificationCenter.addObserver(obs); </pre> </div> <h3><a name="10598">cancelAll</a></h3> <p class="decl">void cancelAll();</p> <div class="description"> <p>Requests cancellation of all tasks. </p> </div> <h3><a name="10601">count</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">int count() const;</p> <div class="description"> <p>Returns the number of tasks in the internal task list. </p> </div> <h3><a name="10599">joinAll</a></h3> <p class="decl">void joinAll();</p> <div class="description"> <p>Waits for the completion of all the threads in the <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a>'s thread pool. </p> </div> <h3><a name="10604">removeObserver</a></h3> <p class="decl">void removeObserver(<br /> const <a href="Poco.AbstractObserver.html" title="class Poco::AbstractObserver">AbstractObserver</a> & observer<br />);</p> <div class="description"> <p>Unregisters an observer with the <a href="Poco.NotificationCenter.html" title="class Poco::NotificationCenter">NotificationCenter</a>. </p> </div> <h3><a name="10596">start</a></h3> <p class="decl">void start(<br /> <a href="Poco.Task.html" title="class Poco::Task">Task</a> * pTask<br />);</p> <div class="description"> <p>Starts the given task in a thread obtained from the thread pool. </p> <p>The <a href="Poco.TaskManager.html" title="class Poco::TaskManager">TaskManager</a> takes ownership of the <a href="Poco.Task.html" title="class Poco::Task">Task</a> object and deletes it when it it finished. </p> </div> <h3><a name="10600">taskList</a></h3> <p class="decl"><a href="Poco.TaskManager.html#10591" title="Poco::TaskManager::TaskList">TaskList</a> taskList() const;</p> <div class="description"> <p>Returns a copy of the internal task list. </p> </div> <h3><a name="10607">postNotification</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void postNotification(<br /> <a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> * pNf<br />);</p> <div class="description"> <p>Posts a notification to the task manager's notification center. </p> </div> <h3><a name="10614">taskCancelled</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void taskCancelled(<br /> <a href="Poco.Task.html" title="class Poco::Task">Task</a> * pTask<br />);</p> <div class="description"> <p></p> </div> <h3><a name="10618">taskFailed</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void taskFailed(<br /> <a href="Poco.Task.html" title="class Poco::Task">Task</a> * pTask,<br /> const <a href="Poco.Exception.html" title="class Poco::Exception">Exception</a> & exc<br />);</p> <div class="description"> <p></p> </div> <h3><a name="10616">taskFinished</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void taskFinished(<br /> <a href="Poco.Task.html" title="class Poco::Task">Task</a> * pTask<br />);</p> <div class="description"> <p></p> </div> <h3><a name="10611">taskProgress</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void taskProgress(<br /> <a href="Poco.Task.html" title="class Poco::Task">Task</a> * pTask,<br /> float progress<br />);</p> <div class="description"> <p></p> </div> <h3><a name="10609">taskStarted</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void taskStarted(<br /> <a href="Poco.Task.html" title="class Poco::Task">Task</a> * pTask<br />);</p> <div class="description"> <p></p> </div> <h2>Variables</h2> <h3><a name="10606">MIN_PROGRESS_NOTIFICATION_INTERVAL</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static const int <a href="Poco.TaskManager.html#10606" title="Poco::TaskManager::MIN_PROGRESS_NOTIFICATION_INTERVAL">MIN_PROGRESS_NOTIFICATION_INTERVAL</a>;</p> <div class="description"> <p></p> </div> <p class="footer">POCO C++ Libraries 1.3.6-all<br /> Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p> </div> </body> </html>