Multi-core Hash Joins
Main-memory hash join implementations for multi-core CPUs
src
affinity.h
Go to the documentation of this file.
1
15
#ifndef AFFINITY_H
16
#define AFFINITY_H
17
18
#include <pthread.h>
/* pthread_* */
19
#include "../config.h"
/* HAVE_PTHREAD_ATTR_SETAFFINITY_NP */
20
21
#ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
22
23
// #include <mach/mach.h>
24
// #include <mach/thread_policy.h>
25
26
#define CPU_ZERO(PTR) (*(PTR) = 0)
27
#define CPU_SET(N, PTR) (*(PTR) = (N))
28
#define pthread_attr_setaffinity_np(ATTR, SZ, PTR) setaffinity(ATTR, SZ, PTR)
29
#define sched_setaffinity(A, SZ, PTR) setaffinity(A, SZ, PTR)
30
31
typedef
int
cpu_set_t;
32
33
static
int
34
setaffinity(pthread_attr_t *attr,
size_t
cpusetsize,
const
cpu_set_t *cpuset);
35
36
int
37
setaffinity(pthread_attr_t *attr,
size_t
cpusetsize,
const
cpu_set_t *cpuset)
38
{
39
/* Not implemented */
40
/*
41
int tid = *cpuset;
42
thread_affinity_policy ap;
43
ap.affinity_tag = tid;
44
45
int ret = thread_policy_set(
46
pthread_mach_thread_np(tid),
47
THREAD_AFFINITY_POLICY,
48
(integer_t*) &ap,
49
THREAD_AFFINITY_POLICY_COUNT
50
);
51
return ret;
52
*/
53
54
return
0;
55
56
}
57
58
#endif
59
60
#endif
/* AFFINITY_H */
Generated on Tue Oct 4 2022 15:20:47 for Multi-core Hash Joins by
1.9.4