11 : data_ (0), control_(new
knowledge::KnowledgeBase ())
33 NamedWorkerThreads::iterator found =
threads_.find (name);
44 for (NamedWorkerThreads::iterator i =
threads_.begin ();
54 NamedWorkerThreads::iterator found =
threads_.find (name);
65 for (NamedWorkerThreads::iterator i =
threads_.begin ();
76 if (name !=
"" && thread != 0)
94 const std::string name, jobject thread,
bool paused)
96 if (name !=
"" && thread != 0)
103 run (name, new_thread, paused);
110 double hertz,
const std::string name, jobject thread,
bool paused)
112 if (name !=
"" && thread != 0)
119 run (hertz, name, new_thread, paused);
123 #endif // _MADARA_JAVA_ 129 if (name !=
"" && thread != 0)
152 NamedWorkerThreads::iterator found =
threads_.find (name);
163 for (NamedWorkerThreads::iterator i =
threads_.begin ();
176 #ifndef _MADARA_NO_KARL_ 177 NamedWorkerThreads::iterator found =
threads_.find (name);
181 std::string condition = found->second->finished_.get_name ();
187 delete found->second;
192 #endif // _MADARA_NO_KARL_ 202 #ifndef _MADARA_NO_KARL_ 203 std::stringstream condition;
205 NamedWorkerThreads::iterator i =
threads_.begin ();
210 condition << i->second->finished_.get_name ();
218 condition << i->second->finished_.get_name ();
223 result = this->
control_->
wait (condition.str (), ws).is_true ();
235 #endif // _MADARA_NO_KARL_ bool is_true(void) const
Checks to see if the record is true.
madara::knowledge::containers::Integer paused
thread safe paused flag that may be set by the Threader
void terminate(void)
Requests all threads to terminate.
void run(void)
Runs the thread once.
Threader()
Default constructor.
NamedWorkerThreads threads_
the threads that are still active
void run(const std::string name, BaseThread *thread, bool paused=false)
Starts a new thread and executes the provided user thread once.
void pause(void)
Requests all threads to pause.
Abstract base class for implementing threads.
madara::knowledge::KnowledgeRecord wait(const std::string &expression, const WaitSettings &settings=WaitSettings())
Waits for an expression to be non-zero.
A thread that executes BaseThread logic.
This class provides a distributed knowledge base to users.
knowledge::KnowledgeBase * control_
The control plane used by threads for termination and pause information.
knowledge::KnowledgeBase * data_
The data plane used by threads.
void resume(void)
Requests all threads to resume (unpause)
int set(const VariableReference &variable, const std::string &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false))
Atomically sets the value of a variable to a string.
Provides functions and classes for the distributed knowledge base.
Encapsulates settings for a wait statement.
void set_data_plane(knowledge::KnowledgeBase &data_plane)
Sets the data plane for new threads.
bool wait(const std::string name, const knowledge::WaitSettings &ws=knowledge::WaitSettings())
Wait for a specific thread to complete.
A facade for a user-defined Java thread class.
static JavaThread * create(jobject obj)
Creates a JavaThread.