Fawkes API  Fawkes Development Version
executor.cpp
1 
2 /***************************************************************************
3  * executor.h - Interface to exec BlockedTimingAspect threads
4  *
5  * Created: Sat Aug 02 13:03:29 2008
6  * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <aspect/blocked_timing/executor.h>
25 
26 namespace fawkes {
27 
28 /** @class BlockedTimingExecutor <aspect/blocked_timing/executor.h>
29  * Blocked timing executor.
30  * This interface defines access to threads with the blocked timing aspect.
31  * @author Tim Niemueller
32  *
33  * @fn void BlockedTimingExecutor::wakeup_and_wait(BlockedTimingAspect::WakeupHook hook, unsigned int timeout_usec)
34  * Wakeup thread for given hook and wait for completion.
35  * This will wakeup all threads registered for the given hook. Afterwards
36  * this method will block until all threads finished their loop.
37  * @param hook hook for which to wait for
38  * @param timeout_usec timeout for thread execution in usec. 0 disables the
39  * timeout and makes this function to wait forever.
40  * @exception Exception thrown if the timeout was exceeded (at least one of the
41  * threads for the given hook took longer than the desired time.
42  *
43  * @fn void BlockedTimingExecutor::wakeup(BlockedTimingAspect::WakeupHook hook, Barrier *barrier = 0)
44  * Wakeup thread for given hook.
45  * This will wakeup all threads registered for the given hook. With the optional
46  * barrier you can synchronize to the end of the loop execution of the threads
47  * of the given hook.
48  * @param hook hook for which to wait for
49  * @param barrier optional barrier that can be used to synchronize to the
50  * end of the loop execution of the threads.
51  *
52  * @fn void BlockedTimingExecutor::try_recover(std::list<std::string> &recovered_threads)
53  * Try to recover threads.
54  * An advanced BlockedTimingExecutor might be able to detect deadlocked threads.
55  * In this case this function should be called regularly to allow for recovering
56  * threads that are back to normal operation.
57  * @param recovered_threads upon return the names of any threads that could be
58  * recovered from a bad state have been added to the list.
59  *
60  * @fn bool BlockedTimingExecutor::timed_threads_exist()
61  * Check if any timed threads exist.
62  * @return true if threads exist that need to be woken up for execution, false
63  * otherwise
64  *
65  * @fn void BlockedTimingExecutor::wait_for_timed_threads()
66  * Wait for timed threads.
67  * Use this method to wait until a timed that is added to the thread manager.
68  * Note that an InterruptedException is thrown if interrup_timed_thread_wait() is
69  * called from another thread. You should catch this exception and stop the loop
70  * execution.
71  * @exception InterruptedException thrown if another thread calls
72  * interrupt_timed_thread_wait()
73  *
74  * @fn void BlockedTimingExecutor::interrupt_timed_thread_wait()
75  * Interrupt any currently running wait_for_timed_threads() and cause it to
76  * throw an InterruptedException.
77  *
78  */
79 
80 /** Virtual empty destructor. */
82 {
83 }
84 
85 } // end namespace fawkes
Fawkes library namespace.
virtual ~BlockedTimingExecutor()
Virtual empty destructor.
Definition: executor.cpp:81