40 #include "../ExecutionEngine.hpp" 41 #include "../base/TaskCore.hpp" 42 #include "../Logger.hpp" 50 #define pipe(X) _pipe((X), 1024, _O_BINARY) 56 #include <sys/select.h> 63 #include <boost/cstdint.hpp> 66 using namespace extras;
84 , m_has_timeout(false)
87 , m_update_sets(false)
104 :
Activity(scheduler, priority, 0.0, _r, name)
120 :
Activity(scheduler, priority, 0.0, _r, name)
123 ,
m_period(period >= 0.0 ? period : 0.0)
136 :
Activity(scheduler, priority, 0.0, cpu_affinity, _r, name)
139 ,
m_period(period >= 0.0 ? period : 0.0)
185 log(
Error) <<
"Ignoring invalid timeout (" << timeout_us <<
")" <<
endlog();
192 log(
Error) <<
"negative file descriptor given to FileDescriptorActivity::watch" <<
endlog();
217 int unused; (void)unused;
237 log(
Error) <<
"FileDescriptorActivity: cannot create control pipe" <<
endlog();
252 log(
Error) <<
"FileDescriptorActivity: could not set the control pipe to non-blocking mode" <<
endlog();
267 log(
Error) <<
"FileDescriptorActivity: Activity::start() failed" <<
endlog();
279 int unused; (void)unused;
326 ret = select(max_fd + 1, &
m_fd_work, NULL, NULL, NULL);
330 static const int USECS_PER_SEC = 1000000;
333 ret = select(max_fd + 1, &
m_fd_work, NULL, NULL, &timeout);
340 log(
Error) <<
"FileDescriptorActivity: error in select(), errno = " << errno <<
endlog();
350 if (ret > 0 && FD_ISSET(pipe, &
m_fd_work))
359 int unused; (void)unused;
360 unused = read(pipe, &dummy, 1);
363 FD_ZERO(&watch_pipe);
364 FD_SET(pipe, &watch_pipe);
368 while(select(pipe + 1, &watch_pipe, NULL, NULL, &timeout) > 0);
372 bool do_trigger =
true;
373 bool user_trigger =
false;
399 else if ( user_trigger )
419 int unused; (void)unused;
virtual void work(WorkReason reason)
A class for running a certain piece of code in a thread.
RunnableInterface * runner
An Activity executes a RunnableInterface object in a (periodic) thread.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
virtual bool isActive() const
static Logger::LogFunction endlog()
virtual bool isRunning() const
MutexLock is a scope based Monitor, protecting critical sections with a Mutex object through locking ...