blob: c16e07769f492aac629bec5eb02e6e81d6aa27e1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "thread.h"
#include <cstring>
namespace vespalib::thread {
std::thread start(Runnable &runnable, Runnable::init_fun_t init_fun_in) {
return std::thread([&runnable, init_fun = std::move(init_fun_in)]()
{
init_fun(runnable);
});
}
size_t as_zu(std::thread::id id) {
size_t res = 0;
static_assert(sizeof(id) <= sizeof(res));
std::memcpy(&res, &id, sizeof(id));
return res;
}
}
|