From aad1db1f6019399294f20c0c4c2ec00e598af842 Mon Sep 17 00:00:00 2001 From: FritzFlorian Date: Thu, 18 Apr 2019 15:41:22 +0200 Subject: [PATCH] Add sleep functionality to thread wrapper. --- lib/pls/include/pls/internal/base/thread.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/pls/include/pls/internal/base/thread.h b/lib/pls/include/pls/internal/base/thread.h index 48dc59c..3ffdf88 100644 --- a/lib/pls/include/pls/internal/base/thread.h +++ b/lib/pls/include/pls/internal/base/thread.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "system_details.h" @@ -44,6 +45,11 @@ class this_thread { pthread_yield(); } + static void sleep(long microseconds) { + timespec time{0, 1000 * microseconds}; + nanosleep(&time, nullptr); + } + /** * Retrieves the local state pointer. * -- libgit2 0.26.0