summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--raul/Thread.hpp8
-rw-r--r--src/Thread.cpp26
2 files changed, 3 insertions, 31 deletions
diff --git a/raul/Thread.hpp b/raul/Thread.hpp
index f6f57d3..fa5a3cb 100644
--- a/raul/Thread.hpp
+++ b/raul/Thread.hpp
@@ -17,8 +17,6 @@
#ifndef RAUL_THREAD_HPP
#define RAUL_THREAD_HPP
-#include <string>
-
#include "raul/Noncopyable.hpp"
namespace Raul {
@@ -56,16 +54,13 @@ public:
*/
virtual bool set_scheduling(bool realtime, unsigned priority);
- /** Return the name of this thread. */
- const std::string& name() const { return _name; }
-
protected:
/** Construct a thread.
*
* Note this does not actually start a thread to prevent race conditions
* during construction. To actually begin execution, call start().
*/
- explicit Thread(const std::string& name="");
+ explicit Thread();
/** Thread function to execute.
*
@@ -81,7 +76,6 @@ private:
static void* _static_run(void* me);
ThreadImpl* _impl;
- std::string _name;
bool _thread_exists;
protected:
diff --git a/src/Thread.cpp b/src/Thread.cpp
index d299138..59d3f1c 100644
--- a/src/Thread.cpp
+++ b/src/Thread.cpp
@@ -14,18 +14,9 @@
along with Raul. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <cstring>
-#include <string>
-
#include <pthread.h>
-#include "raul/log.hpp"
#include "raul/Thread.hpp"
-#include "raul/ThreadVar.hpp"
-
-#define LOG(s) (s("[")(_name)("] "))
-
-using std::endl;
namespace Raul {
@@ -33,9 +24,8 @@ struct ThreadImpl {
pthread_t pthread;
};
-Thread::Thread(const std::string& name)
+Thread::Thread()
: _impl(new ThreadImpl())
- , _name(name)
, _thread_exists(false)
, _exit_flag(false)
{
@@ -60,8 +50,6 @@ void
Thread::start()
{
if (!_thread_exists) {
- LOG(info) << "Starting thread" << endl;
-
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 1500000);
@@ -78,7 +66,6 @@ Thread::join()
_exit_flag = true;
pthread_join(_impl->pthread, NULL);
_thread_exists = false;
- LOG(info) << "Exiting thread" << endl;
}
}
@@ -88,16 +75,7 @@ Thread::set_scheduling(bool realtime, unsigned priority)
sched_param sp;
sp.sched_priority = priority;
const int policy = realtime ? SCHED_FIFO : SCHED_OTHER;
- const int result = pthread_setschedparam(_impl->pthread, policy, &sp);
- if (!result) {
- LOG(info) << (fmt("Set scheduling policy to %1% priority %2%\n")
- % (realtime ? "realtime" : "normal")
- % sp.sched_priority);
- } else {
- LOG(warn) << (fmt("Unable to set scheduling policy (%1%)\n")
- % strerror(result));
- }
- return !result;
+ return !pthread_setschedparam(_impl->pthread, policy, &sp);
}
} // namespace Raul