1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
$NetBSD: patch-ad,v 1.1.1.1 2010/08/26 13:08:49 adam Exp $
--- ./src/OpenThreads/pthreads/PThread.c++.orig 2009-06-22 12:51:46.000000000 +0200
+++ ./src/OpenThreads/pthreads/PThread.c++ 2009-06-22 16:55:54.000000000 +0200
@@ -124,6 +124,15 @@
{
#if defined(__sgi)
pthread_setrunon_np( pd->cpunum );
+#elif defined(__NetBSD__) && defined(HAVE_PTHREAD_SETAFFINITY_NP)
+ cpuset_t *cset;
+ cset = cpuset_create();
+ if (cset != NULL)
+ {
+ cpuset_set(pd->cpunum, cset);
+ pthread_setaffinity_np(pthread_self(), cpuset_size(cset), cset);
+ cpuset_destroy(cset);
+ }
#elif defined(HAVE_PTHREAD_SETAFFINITY_NP) || defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY) || defined(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
cpu_set_t cpumask;
CPU_ZERO( &cpumask );
@@ -537,6 +546,18 @@
status = pthread_attr_setscope( &thread_attr, PTHREAD_SCOPE_BOUND_NP );
return status;
+#elif defined(__NetBSD__) && defined(HAVE_PTHREAD_SETAFFINITY_NP)
+ if (pd->isRunning && Thread::CurrentThread()==this)
+ {
+ cpuset_t *cset;
+ cset = cpuset_create();
+ if (cset != NULL)
+ {
+ cpuset_set(pd->cpunum, cset);
+ pthread_setaffinity_np(pthread_self(), cpuset_size(cset), cset);
+ cpuset_destroy(cset);
+ }
+ }
#elif defined(HAVE_PTHREAD_SETAFFINITY_NP) || defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY) || defined(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
if (pd->isRunning && Thread::CurrentThread()==this)
@@ -974,7 +995,16 @@
}
else
{
-#if defined(HAVE_PTHREAD_SETAFFINITY_NP) || defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY) || defined(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
+#if defined(__NetBSD__) && defined(HAVE_PTHREAD_SETAFFINITY_NP)
+ cpuset_t *cset;
+ cset = cpuset_create();
+ if (cset != NULL)
+ {
+ cpuset_set(cpunum, cset);
+ pthread_setaffinity_np(pthread_self(), cpuset_size(cset), cset);
+ cpuset_destroy(cset);
+ }
+#elif defined(HAVE_PTHREAD_SETAFFINITY_NP) || defined(HAVE_THREE_PARAM_SCHED_SETAFFINITY) || defined(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
cpu_set_t cpumask;
CPU_ZERO( &cpumask );
CPU_SET( cpunum, &cpumask );
|