diff options
author | David Robillard <d@drobilla.net> | 2013-02-04 00:54:25 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-02-04 00:54:25 +0000 |
commit | 5034a4b8cfcbc57423028031419f0f38a2ffc405 (patch) | |
tree | 78a035592d478961c70f797a73b6b09fe5fe486b /test/sem_test.cpp | |
parent | 125de9306bc724d70dd377c5cadf1af98a5db933 (diff) | |
download | raul-5034a4b8cfcbc57423028031419f0f38a2ffc405.tar.gz raul-5034a4b8cfcbc57423028031419f0f38a2ffc405.tar.bz2 raul-5034a4b8cfcbc57423028031419f0f38a2ffc405.zip |
Replace Raul::thread with std::thread.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@5047 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test/sem_test.cpp')
-rw-r--r-- | test/sem_test.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/test/sem_test.cpp b/test/sem_test.cpp index 1836317..4211ce3 100644 --- a/test/sem_test.cpp +++ b/test/sem_test.cpp @@ -14,36 +14,30 @@ along with Raul. If not, see <http://www.gnu.org/licenses/>. */ -#include <iostream> #include <limits.h> #include <unistd.h> -#include "raul/Thread.hpp" +#include <iostream> +#include <thread> + #include "raul/Semaphore.hpp" using namespace std; using namespace Raul; -class Waiter : public Raul::Thread { -public: - Waiter(Semaphore& sem) : Raul::Thread(), _sem(sem) - {} - -private: - void _run() { - while (true) { - if (_sem.timed_wait(250)) { - cout << "[Waiter] Received signal" << endl; - break; - } else { - cout << "[Waiter] Timed out" << endl; - } +static void +wait(Semaphore* sem) +{ + while (true) { + if (sem->timed_wait(250)) { + cout << "[Waiter] Received signal" << endl; + break; + } else { + cout << "[Waiter] Timed out" << endl; } - cout << "[Waiter] Exiting" << endl; } - - Semaphore& _sem; -}; + cout << "[Waiter] Exiting" << endl; +} int main() @@ -60,8 +54,7 @@ main() return 1; } - Waiter waiter(sem); - waiter.start(); + std::thread waiter(wait, &sem); sleep(1); |