mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-03-25 13:17:38 +00:00
Some more constructors
This commit is contained in:
parent
069807caf4
commit
2d87059a04
14
geobuf.cpp
14
geobuf.cpp
@ -425,6 +425,10 @@ struct queue_run_arg {
|
||||
size_t start;
|
||||
size_t end;
|
||||
size_t segment;
|
||||
|
||||
queue_run_arg(size_t start1, size_t end1, size_t segment1)
|
||||
: start(start1), end(end1), segment(segment1) {
|
||||
}
|
||||
};
|
||||
|
||||
void *run_parse_feature(void *v) {
|
||||
@ -444,7 +448,6 @@ void runQueue() {
|
||||
}
|
||||
|
||||
std::vector<struct queue_run_arg> qra;
|
||||
qra.resize(CPUS);
|
||||
|
||||
std::vector<pthread_t> pthreads;
|
||||
pthreads.resize(CPUS);
|
||||
@ -452,10 +455,13 @@ void runQueue() {
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
*((*(feature_queue[0].sst))[i].layer_seq) = *((*(feature_queue[0].sst))[0].layer_seq) + feature_queue.size() * i / CPUS;
|
||||
|
||||
qra[i].start = feature_queue.size() * i / CPUS;
|
||||
qra[i].end = feature_queue.size() * (i + 1) / CPUS;
|
||||
qra[i].segment = i;
|
||||
qra.push_back(queue_run_arg(
|
||||
feature_queue.size() * i / CPUS,
|
||||
feature_queue.size() * (i + 1) / CPUS,
|
||||
i));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
if (pthread_create(&pthreads[i], NULL, run_parse_feature, &qra[i]) != 0) {
|
||||
perror("pthread_create");
|
||||
exit(EXIT_FAILURE);
|
||||
|
25
main.cpp
25
main.cpp
@ -302,6 +302,10 @@ struct sort_arg {
|
||||
size_t nmerges;
|
||||
long long unit;
|
||||
int bytes;
|
||||
|
||||
sort_arg(int task1, int cpus1, long long indexpos1, struct mergelist *merges1, int indexfd1, size_t nmerges1, long long unit1, int bytes1)
|
||||
: task(task1), cpus(cpus1), indexpos(indexpos1), merges(merges1), indexfd(indexfd1), nmerges(nmerges1), unit(unit1), bytes(bytes1) {
|
||||
}
|
||||
};
|
||||
|
||||
void *run_sort(void *v) {
|
||||
@ -726,18 +730,21 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
||||
}
|
||||
|
||||
pthread_t pthreads[CPUS];
|
||||
struct sort_arg args[CPUS];
|
||||
std::vector<sort_arg> args;
|
||||
|
||||
for (size_t a = 0; a < CPUS; a++) {
|
||||
args[a].task = a;
|
||||
args[a].cpus = CPUS;
|
||||
args[a].indexpos = indexpos;
|
||||
args[a].merges = merges;
|
||||
args[a].indexfd = indexfds[i];
|
||||
args[a].nmerges = nmerges;
|
||||
args[a].unit = unit;
|
||||
args[a].bytes = bytes;
|
||||
args.push_back(sort_arg(
|
||||
a,
|
||||
CPUS,
|
||||
indexpos,
|
||||
merges,
|
||||
indexfds[i],
|
||||
nmerges,
|
||||
unit,
|
||||
bytes));
|
||||
}
|
||||
|
||||
for (size_t a = 0; a < CPUS; a++) {
|
||||
if (pthread_create(&pthreads[a], NULL, run_sort, &args[a]) != 0) {
|
||||
perror("pthread_create");
|
||||
exit(EXIT_FAILURE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user