diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-02-01 16:35:20 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-02-01 16:35:20 +0100 |
| commit | 130765de719a3ddc475284e13749d09ff371a8e1 (patch) | |
| tree | c45ea8d47e53481022d641336ec2abd5cb588111 /src/benchmarks/fred.h | |
| parent | 8221b8fb0e9ee491590932cd228f17b48155c0f7 (diff) | |
| download | allocbench-130765de719a3ddc475284e13749d09ff371a8e1.tar.gz allocbench-130765de719a3ddc475284e13749d09ff371a8e1.zip | |
rework build system #1
each benchmark has its own Makefile which must put it's binaries into
OBJDIR which is added to the PATH during execution.
Diffstat (limited to 'src/benchmarks/fred.h')
| -rw-r--r-- | src/benchmarks/fred.h | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/src/benchmarks/fred.h b/src/benchmarks/fred.h deleted file mode 100644 index b0198a7..0000000 --- a/src/benchmarks/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 |
