Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a simple test to check whether the compiler accepts __thread
authorChristophe Thiéry <christopho128@gmail.com>
Fri, 22 Apr 2011 14:43:35 +0000 (16:43 +0200)
committerChristophe Thiéry <christopho128@gmail.com>
Fri, 22 Apr 2011 14:43:35 +0000 (16:43 +0200)
buildtools/Cmake/test_prog/prog_thread_storage.c [new file with mode: 0644]

diff --git a/buildtools/Cmake/test_prog/prog_thread_storage.c b/buildtools/Cmake/test_prog/prog_thread_storage.c
new file mode 100644 (file)
index 0000000..060be0a
--- /dev/null
@@ -0,0 +1,16 @@
+/* Copyright (c) 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <stdio.h>
+
+__thread int thread_specific_variable = 0;
+
+int main(void) {
+
+  thread_specific_variable++;
+  printf("%d\n", thread_specific_variable);
+  return 0;
+}