diff --git a/thread.h b/thread.h
index 16c4bd75..dd21346c 100644
--- a/thread.h
+++ b/thread.h
@@ -13,6 +13,9 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <sys/types.h>
+#if __cplusplus >= 201103L
+# include <atomic>
+#endif
 
 typedef pid_t tThreadId;
 
@@ -79,8 +82,13 @@ public:
 class cThread {
   friend class cThreadLock;
 private:
+#if __cplusplus >= 201103L
+  std::atomic<bool> active;
+  std::atomic<bool> running;
+#else
   bool active;
   bool running;
+#endif
   pthread_t childTid;
   tThreadId childThreadId;
   cMutex mutex;
