[beast: 13/20] SFI: provide Bse::ThreadId and Bse::this_thread_self
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 13/20] SFI: provide Bse::ThreadId and Bse::this_thread_self
- Date: Sun, 24 Sep 2017 00:20:44 +0000 (UTC)
commit eca1e43ec9bb4328f9a5298b43b80424ae1e005c
Author: Tim Janik <timj gnu org>
Date: Sun Sep 17 12:36:51 2017 +0200
SFI: provide Bse::ThreadId and Bse::this_thread_self
Signed-off-by: Tim Janik <timj gnu org>
sfi/platform.cc | 6 ++++++
sfi/platform.hh | 13 ++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/sfi/platform.cc b/sfi/platform.cc
index 7dc10a4..e65a9c0 100644
--- a/sfi/platform.cc
+++ b/sfi/platform.cc
@@ -322,6 +322,12 @@ TaskStatus::string ()
}
// == Thread Info ==
+ThreadId
+this_thread_self ()
+{
+ return std::this_thread::get_id();
+}
+
void
this_thread_set_name (const String &name16chars)
{
diff --git a/sfi/platform.hh b/sfi/platform.hh
index 4fba0df..bbc2aca 100644
--- a/sfi/platform.hh
+++ b/sfi/platform.hh
@@ -3,6 +3,7 @@
#define __BSE_PLATFORM_HH__
#include <sfi/cxxaux.hh>
+#include <thread>
namespace Bse {
@@ -45,11 +46,13 @@ struct TaskStatus {
};
// == Thread Info ==
-void this_thread_set_name (const String &name16chars);
-String this_thread_get_name ();
-int this_thread_getpid ();
-int this_thread_gettid ();
-int this_thread_online_cpus ();
+using ThreadId = std::thread::id;
+ThreadId this_thread_self ();
+void this_thread_set_name (const String &name16chars);
+String this_thread_get_name ();
+int this_thread_getpid ();
+int this_thread_gettid ();
+int this_thread_online_cpus ();
// == Debugging Aids ==
extern inline void breakpoint () BSE_ALWAYS_INLINE; ///< Cause a debugging breakpoint,
for development only.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]