diff options
Diffstat (limited to 'raul')
-rw-r--r-- | raul/Semaphore.hpp | 7 | ||||
-rw-r--r-- | raul/Thread.hpp | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/raul/Semaphore.hpp b/raul/Semaphore.hpp index 93dae0a..3bd6ac4 100644 --- a/raul/Semaphore.hpp +++ b/raul/Semaphore.hpp @@ -31,7 +31,8 @@ namespace Raul { * work in GDB. Turns out sem_wait can fail when run in GDB, and Debian * really needs to update it's man pages. * - * This class remains as a trivial (yet pretty) wrapper/abstraction. + * This class remains as a trivial (yet pretty) wrapper/abstraction, because + * Glib (idiotically) doesn't have a Semaphore class. * * \ingroup raul */ @@ -61,9 +62,11 @@ public: /** Non-blocking version of wait(). * + * \return true if decrement was successful (lock was acquired). + * * Realtime safe? */ - inline int try_wait() { return sem_trywait(&_sem); } + inline bool try_wait() { return (sem_trywait(&_sem) == 0); } private: sem_t _sem; diff --git a/raul/Thread.hpp b/raul/Thread.hpp index e444c6e..29cade1 100644 --- a/raul/Thread.hpp +++ b/raul/Thread.hpp @@ -56,11 +56,11 @@ public: void set_scheduling(int policy, unsigned int priority); - const std::string& name() { return _name; } + const std::string& name() const { return _name; } void set_name(const std::string& name) { _name = name; } - const unsigned context() { return _context; } - void set_context(unsigned context) { _context = context; } + unsigned context() const { return _context; } + void set_context(unsigned context) { _context = context; } protected: Thread(const std::string& name=""); |