summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--raul/Atom.hpp2
-rw-r--r--raul/Thread.hpp5
-rw-r--r--raul/log.hpp6
-rw-r--r--src/Thread.cpp6
4 files changed, 11 insertions, 8 deletions
diff --git a/raul/Atom.hpp b/raul/Atom.hpp
index c2a2c65..395cc47 100644
--- a/raul/Atom.hpp
+++ b/raul/Atom.hpp
@@ -162,6 +162,8 @@ public:
, Dict(7)
{}
+ virtual ~Forge() {}
+
Atom make() { return Atom(); }
Atom make(int32_t v) { return Atom(sizeof(int32_t), Int, &v); }
Atom make(float v) { return Atom(sizeof(float), Float, &v); }
diff --git a/raul/Thread.hpp b/raul/Thread.hpp
index bc469f4..84c79a7 100644
--- a/raul/Thread.hpp
+++ b/raul/Thread.hpp
@@ -46,6 +46,11 @@ public:
static Thread* create_for_this_thread(const std::string& name="");
+ /** Return the calling thread.
+ *
+ * If the calling thread does not yet have a Thread object associated with
+ * it, one will be created.
+ */
static Thread& get();
virtual void start();
diff --git a/raul/log.hpp b/raul/log.hpp
index d121290..4dbf069 100644
--- a/raul/log.hpp
+++ b/raul/log.hpp
@@ -46,8 +46,8 @@ public:
LogBuffer(const char* prefix="", Colour colour=DEFAULT)
: _prefix(prefix)
- , _colour(colour)
, _out(std::cout)
+ , _colour(colour)
{}
/** Change the colour of the output, e.g. out << colour(RED) << "red" << endl; */
@@ -75,10 +75,10 @@ protected:
private:
void emit();
- const char* _prefix;
- Colour _colour;
+ std::string _prefix;
std::string _line;
std::ostream& _out;
+ Colour _colour;
};
class NullBuffer : public std::streambuf
diff --git a/src/Thread.cpp b/src/Thread.cpp
index 88919d2..e35d347 100644
--- a/src/Thread.cpp
+++ b/src/Thread.cpp
@@ -76,17 +76,13 @@ Thread::create_for_this_thread(const std::string& name)
return new Thread(pthread_self(), name);
}
-/** Return the calling thread.
- * The return value of this should NOT be cached unless the thread is
- * explicitly user created with create().
- */
Thread&
Thread::get()
{
Thread* this_thread = reinterpret_cast<Thread*>(
pthread_getspecific(s_thread_key));
if (!this_thread)
- this_thread = new Thread(); // sets thread-specific data
+ this_thread = create_for_this_thread("");
return *this_thread;
}