diff --git a/SimoxUtility/CMakeLists.txt b/SimoxUtility/CMakeLists.txt
index 608bb4cda667725124406a39272e10e0ce61fd23..02e16fe9dcf44ab1d8452047f998e4aa9c10b89a 100644
--- a/SimoxUtility/CMakeLists.txt
+++ b/SimoxUtility/CMakeLists.txt
@@ -86,6 +86,8 @@ SET(SOURCES
 
     shapes/AxisAlignedBoundingBox.cpp
     shapes/json_conversions.cpp
+
+    threads/system_thread_id.cpp
 )
 
 SET(INCLUDES
@@ -252,6 +254,8 @@ SET(INCLUDES
     shapes/json_conversions.h
 
     backport/span/gcc_header.h
+
+    threads/system_thread_id.h
 )
 
 simox_generate_subdir_headers(
diff --git a/SimoxUtility/threads.h b/SimoxUtility/threads.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd685bff07eeb0cd366b4c6f4390d714c20494c9
--- /dev/null
+++ b/SimoxUtility/threads.h
@@ -0,0 +1,5 @@
+#pragma once
+
+// This file is generated!
+
+#include "threads/system_thread_id.h"
diff --git a/SimoxUtility/threads/system_thread_id.cpp b/SimoxUtility/threads/system_thread_id.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f20ffb647d886a1698822c2f08c2240568fc4490
--- /dev/null
+++ b/SimoxUtility/threads/system_thread_id.cpp
@@ -0,0 +1,13 @@
+#include <syscall.h>
+#include <unistd.h>
+
+#include "system_thread_id.h"
+
+namespace simox
+{
+    long system_thread_id()
+    {
+        return syscall(SYS_gettid);
+    }
+}
+
diff --git a/SimoxUtility/threads/system_thread_id.h b/SimoxUtility/threads/system_thread_id.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed48a2bbd159c21c99fb0a421a9c330182d45626
--- /dev/null
+++ b/SimoxUtility/threads/system_thread_id.h
@@ -0,0 +1,7 @@
+#pragma once
+
+namespace simox
+{
+    long system_thread_id();
+}
+