aboutsummaryrefslogtreecommitdiff
path: root/src/benchmarks/falsesharing/fred.h
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-05-06 16:56:32 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-06-02 11:18:47 +0200
commit8174a918ea3b7cb216bf7ea98cfdc10661b5c37d (patch)
tree0747ec3ccb9f8d7eeccfac35977fc17855ca3bbb /src/benchmarks/falsesharing/fred.h
parent8f52e8fc02dd235582f5961941bcd564e9a681cd (diff)
downloadallocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.tar.gz
allocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.zip
make the whole project more python idiomatic
* rename src directory to allocbench * make global variable names UPPERCASE * format a lot of code using yapf * use lowercase ld_preload and ld_library_path as Allocator members * name expected Errors 'err' and don't raise a new Exception * disable some pylint messages
Diffstat (limited to 'src/benchmarks/falsesharing/fred.h')
-rw-r--r--src/benchmarks/falsesharing/fred.h97
1 files changed, 0 insertions, 97 deletions
diff --git a/src/benchmarks/falsesharing/fred.h b/src/benchmarks/falsesharing/fred.h
deleted file mode 100644
index b0198a7..0000000
--- a/src/benchmarks/falsesharing/fred.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// -*- C++ -*-
-
-#ifndef HL_FRED_H
-#define HL_FRED_H
-
-/// A thread-wrapper of childlike simplicity :).
-
-#if defined(_WIN32)
-
- #include <windows.h>
- #include <process.h>
-
-#elif defined(__SVR4)
-
- #include <thread.h>
- #include <pthread.h>
- #include <unistd.h>
-
-#else
-
- #include <pthread.h>
- #include <unistd.h>
-
-#endif
-
-typedef void * (*ThreadFunctionType) (void *);
-
-namespace HL {
-
-class Fred {
-public:
-
- Fred() {
-#if !defined(_WIN32)
- pthread_attr_init (&attr);
- pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
-#endif
- }
-
- ~Fred() {
-#if !defined(_WIN32)
- pthread_attr_destroy (&attr);
-#endif
- }
-
- void create (ThreadFunctionType function, void * arg) {
-#if defined(_WIN32)
- t = CreateThread (0, 0, (LPTHREAD_START_ROUTINE) *function, (LPVOID) arg, 0, 0);
-#else
- pthread_create (&t, &attr, function, arg);
-#endif
- }
-
- void join (void) {
-#if defined(_WIN32)
- WaitForSingleObject (t, INFINITE);
-#else
- pthread_join (t, NULL);
-#endif
- }
-
- static void yield (void) {
-#if defined(_WIN32)
- Sleep (0);
-#elif defined(__SVR4)
- thr_yield();
-#else
- sched_yield();
-#endif
- }
-
-
- static void setConcurrency (int n) {
-#if defined(_WIN32)
-#elif defined(__SVR4)
- thr_setconcurrency (n);
-#else
- pthread_setconcurrency (n);
-#endif
- }
-
-
-private:
-#if defined(_WIN32)
- typedef HANDLE FredType;
-#else
- typedef pthread_t FredType;
- pthread_attr_t attr;
-#endif
-
- FredType t;
-};
-
-}
-
-
-#endif