Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "thread_local is C++11, remove the portability layer"
[simgrid.git] / tools / cmake / test_prog / prog_thread_storage.c
diff --git a/tools/cmake/test_prog/prog_thread_storage.c b/tools/cmake/test_prog/prog_thread_storage.c
new file mode 100644 (file)
index 0000000..edcab03
--- /dev/null
@@ -0,0 +1,21 @@
+/* Copyright (c) 2010-2011, 2013-2014. 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>
+
+#ifdef _MSC_VER
+__declspec(thread)
+#else 
+__thread 
+#endif
+int thread_specific_variable = 0;
+
+int main(void) {
+
+  thread_specific_variable++;
+  printf("%d\n", thread_specific_variable);
+  return 0;
+}