diff options
author | Gabor Greif <ggreif@gmail.com> | 2014-08-08 18:01:19 +0200 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2014-08-08 18:01:19 +0200 |
commit | 5f003d228340c3ce8e500f9053f353c58dc1dc94 (patch) | |
tree | a855b0f173ff635b48354e1136ef6cbb2a1214a4 /rts/posix/OSThreads.c | |
parent | ff9c5570395bcacf8963149b3a8475f5644ce694 (diff) | |
parent | dff0623d5ab13222c06b3ff6b32793e05b417970 (diff) | |
download | haskell-wip/generics-propeq.tar.gz |
Merge branch 'master' into wip/generics-propeqwip/generics-propeq
Conflicts:
compiler/typecheck/TcGenGenerics.lhs
Diffstat (limited to 'rts/posix/OSThreads.c')
-rw-r--r-- | rts/posix/OSThreads.c | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 13a176c9d2..f42b4e964c 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -3,7 +3,7 @@ * (c) The GHC Team, 2001-2005 * * Accessing OS threads functionality in a (mostly) OS-independent - * manner. + * manner. * * --------------------------------------------------------------------------*/ @@ -18,7 +18,7 @@ #if defined(freebsd_HOST_OS) /* Inclusion of system headers usually requires __BSD_VISIBLE on FreeBSD, * because of some specific types, like u_char, u_int, etc. */ -#define __BSD_VISIBLE 1 +#define __BSD_VISIBLE 1 #endif #include "Rts.h" @@ -175,7 +175,7 @@ newThreadLocalKey (ThreadLocalKey *key) { int r; if ((r = pthread_key_create(key, NULL)) != 0) { - barf("newThreadLocalKey: %s", strerror(r)); + barf("newThreadLocalKey: %s", strerror(r)); } } @@ -194,7 +194,7 @@ setThreadLocalVar (ThreadLocalKey *key, void *value) { int r; if ((r = pthread_setspecific(*key,value)) != 0) { - barf("setThreadLocalVar: %s", strerror(r)); + barf("setThreadLocalVar: %s", strerror(r)); } } @@ -203,7 +203,7 @@ freeThreadLocalKey (ThreadLocalKey *key) { int r; if ((r = pthread_key_delete(*key)) != 0) { - barf("freeThreadLocalKey: %s", strerror(r)); + barf("freeThreadLocalKey: %s", strerror(r)); } } @@ -222,7 +222,7 @@ forkOS_createThread ( HsStablePtr entry ) { pthread_t tid; int result = pthread_create(&tid, NULL, - forkOS_createThreadWrapper, (void*)entry); + forkOS_createThreadWrapper, (void*)entry); if(!result) pthread_detach(tid); return result; @@ -277,33 +277,34 @@ setThreadAffinity (nat n, nat m GNUC3_ATTRIBUTE(__unused__)) thread_affinity_policy_data_t policy; policy.affinity_tag = n; - thread_policy_set(mach_thread_self(), - THREAD_AFFINITY_POLICY, - (thread_policy_t) &policy, - THREAD_AFFINITY_POLICY_COUNT); + thread_policy_set(mach_thread_self(), + THREAD_AFFINITY_POLICY, + (thread_policy_t) &policy, + THREAD_AFFINITY_POLICY_COUNT); } #elif defined(HAVE_SYS_CPUSET_H) /* FreeBSD 7.1+ */ void setThreadAffinity(nat n, nat m) { - nat nproc; - cpuset_t cs; - nat i; + nat nproc; + cpuset_t cs; + nat i; - nproc = getNumberOfProcessors(); - CPU_ZERO(&cs); + nproc = getNumberOfProcessors(); + CPU_ZERO(&cs); - for (i = n; i < nproc; i += m) - CPU_SET(i, &cs); + for (i = n; i < nproc; i += m) + CPU_SET(i, &cs); - cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(cpuset_t), &cs); + cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, sizeof(cpuset_t), &cs); } #else void -setThreadAffinity (nat n GNUC3_ATTRIBUTE(__unused__), - nat m GNUC3_ATTRIBUTE(__unused__)) +setThreadAffinity (nat n GNUC3_ATTRIBUTE(__unused__), + nat m GNUC3_ATTRIBUTE(__unused__)) { } #endif @@ -340,7 +341,9 @@ KernelThreadId kernelThreadId (void) return pthread_getthreadid_np(); // Check for OS X >= 10.6 (see #7356) -#elif defined(darwin_HOST_OS) && !(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1060) +#elif defined(darwin_HOST_OS) && \ + !(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + __MAC_OS_X_VERSION_MIN_REQUIRED < 1060) uint64_t ktid; pthread_threadid_np(NULL, &ktid); return ktid; @@ -350,3 +353,11 @@ KernelThreadId kernelThreadId (void) return 0; #endif } + +// Local Variables: +// mode: C +// fill-column: 80 +// indent-tabs-mode: nil +// c-basic-offset: 4 +// buffer-file-coding-system: utf-8-unix +// End: |