Commit aad1db1f by FritzFlorian

Add sleep functionality to thread wrapper.

parent 37f7753a
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <functional> #include <functional>
#include <pthread.h> #include <pthread.h>
#include <atomic> #include <atomic>
#include <time.h>
#include "system_details.h" #include "system_details.h"
...@@ -44,6 +45,11 @@ class this_thread { ...@@ -44,6 +45,11 @@ class this_thread {
pthread_yield(); pthread_yield();
} }
static void sleep(long microseconds) {
timespec time{0, 1000 * microseconds};
nanosleep(&time, nullptr);
}
/** /**
* Retrieves the local state pointer. * Retrieves the local state pointer.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment