Fawkes API
Fawkes Development Version
|
22 #include <aspect/syncpoint.h>
23 #include <core/threading/thread.h>
44 std::string identifier_in,
45 std::string identifier_out )
47 identifier_in_(identifier_in),
48 identifier_out_(identifier_out),
53 has_input_syncpoint_ = (identifier_in !=
"");
54 has_output_syncpoint_ = (identifier_out !=
"");
65 identifier_out_(identifier_out),
70 has_input_syncpoint_ =
false;
71 has_output_syncpoint_ =
true;
89 if (has_input_syncpoint_) {
93 if (has_output_syncpoint_) {
98 if (has_input_syncpoint_ || has_output_syncpoint_) {
111 if (has_input_syncpoint_) {
115 if (has_output_syncpoint_) {
120 if (has_input_syncpoint_ || has_output_syncpoint_) {
131 if (has_input_syncpoint_) {
132 sp_in_->
wait(thread->
name(), type_in_);
142 if (has_output_syncpoint_) {
WakeupType
Type to define when a thread wakes up after waiting for a SyncPoint.
void add_aspect(const char *name)
Add an aspect to a thread.
This class gives access to SyncPoints.
virtual void emit(const std::string &component)
send a signal to all waiting threads
void post_loop(Thread *thread)
Emit the output syncpoint after loop()
void add_loop_listener(ThreadLoopListener *loop_listener)
Add loop listener.
const char * name() const
Get name of thread.
RefPtr< SyncPoint > get_syncpoint(const std::string &component, const std::string &identifier)
Get a SyncPoint.
void finalize_SyncPointAspect(Thread *thread, SyncPointManager *syncpoint_manager)
Finalize SyncPoint aspect.
virtual void unregister_emitter(const std::string &component, bool emit_if_pending=true)
unregister as emitter
Fawkes library namespace.
SyncPointAspect(SyncPoint::WakeupType type_in, std::string identifier_in, std::string identifier_out="")
Constructor.
virtual ~SyncPointAspect()
Destructor.
Thread class encapsulation of pthreads.
void init_SyncPointAspect(Thread *thread, SyncPointManager *syncpoint_manager)
Init SyncPoint aspect.
virtual void register_emitter(const std::string &component)
register as emitter
void pre_loop(Thread *thread)
Wait for the input syncpoint before loop()
void remove_loop_listener(ThreadLoopListener *loop_listener)
Remove loop listener.
virtual void wait(const std::string &component, WakeupType=WAIT_FOR_ONE, uint wait_sec=0, uint wait_nsec=0)
wait for the sync point to be emitted by any other component
void release_syncpoint(const std::string &component, RefPtr< SyncPoint > syncpoint)
Release a SyncPoint.