• Mutex - multi-thread variable protection.

  • Thread - raii style one-shot thread class.

  • Threadable - an inheritable thread interface.

There are also a few methods for setting thread/process priorities.

Cross Platform Support

Currently the windows code is available, but not currently present (need to port it from the old version of ecl) because it isn't getting used/tested frequently. It can be added back in when and as needed quickly as the framework is still in place.

Compiling & Linking

Include the following at the top of any translation unit:

   1 #include <ecl/threads.hpp>
   3 // The thread classes
   4 using ecl::Mutex;
   5 using ecl::Thread;
   6 using ecl::Threadable;
   8 // Priorities
   9 using ecl::set_priority;
  10 using ecl::get_priority;
  11 using ecl::print_priority_diagnostics;
  12 using ecl::BackgroundPriority;
  13 using ecl::LowPriority;
  14 using ecl::NormalPriority;  
  15 using ecl::HighPriority;    
  16 using ecl::CriticalPriority;
  17 using ecl::RealTimePriority1;   
  18 using ecl::RealTimePriority2;   
  19 using ecl::RealTimePriority3;   
  20 using ecl::RealTimePriority4;   

If using catkin with ROS, you should make sure to declare a dependency on ecl_threads in your package.xml and find_package ecl_threads in your CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS
   # other dependencies ...

If outside ros, you will also need to link to ecl_threads.


  • Thread : threading functionality via composition.

  • Threadable : threading functionality via inheritance.

  • Thread Locks : locking threads to protect shared data.

  • Priorities : setting thread or process scheduling priorities.

Wiki: ecl_threads (last edited 2014-11-24 18:41:08 by AustinHendrix)