]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/benchmarks/tls.cpp
Document lack of wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK under OS X.
[wxWidgets.git] / tests / benchmarks / tls.cpp
index 213d3e87df6301ced8169a8bab39e8e7e2549ae5..cca9110d8aa69897a21b5b73e375210330d2471b 100644 (file)
@@ -5,11 +5,13 @@
 // Created:     2008-07-19
 // RCS-ID:      $Id$
 // Copyright:   (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
 // Created:     2008-07-19
 // RCS-ID:      $Id$
 // Copyright:   (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "bench.h"
 
 /////////////////////////////////////////////////////////////////////////////
 
 #include "bench.h"
 
+#include "wx/tls.h"
+
 #if defined(__UNIX__)
     #define HAVE_PTHREAD
     #include <pthread.h>
 #if defined(__UNIX__)
     #define HAVE_PTHREAD
     #include <pthread.h>
@@ -28,7 +30,7 @@
 
 // uncomment this to also test Boost version (you will also need to link with
 // libboost_threads)
 
 // uncomment this to also test Boost version (you will also need to link with
 // libboost_threads)
-#define HAVE_BOOST_THREAD
+//#define HAVE_BOOST_THREAD
 #ifdef HAVE_BOOST_THREAD
     #include <boost/thread/tss.hpp>
 #endif
 #ifdef HAVE_BOOST_THREAD
     #include <boost/thread/tss.hpp>
 #endif
@@ -171,3 +173,19 @@ BENCHMARK_FUNC(BoostTLS)
 }
 
 #endif // HAVE_BOOST_THREAD
 }
 
 #endif // HAVE_BOOST_THREAD
+
+BENCHMARK_FUNC(wxTLS)
+{
+    static wxTLS_TYPE(int) s_globalVar;
+    #define s_global wxTLS_VALUE(s_globalVar)
+
+    for ( int n = 0; n < NUM_ITER; n++ )
+    {
+        if ( n % 2 )
+            s_global = 0;
+        else
+            s_global = n;
+    }
+
+    return !s_global;
+}