1#ifndef _SINGULAR_LIBTHREAD
2#define _SINGULAR_LIBTHREAD
24#ifdef USE_SHARED_ALLOCATOR
27struct SharedAllocator {
32 template <
class U> SharedAllocator(
const SharedAllocator<U>&)
noexcept {
35 T *allocate(std::size_t n) {
36 T *
p = shared_alloc0<T>(n);
38 throw std::bad_alloc();
40 void deallocate(
T *
p, std::size_t n)
noexcept {
45typedef std::basic_string<char, std::char_traits<char>, SharedAllocator<char> >
49class SharedVector :
public std::vector<T, SharedAllocator<T> > {
51 SharedVector() : std::vector<
T, SharedAllocator<
T>>() { }
52 SharedVector(std::size_t n,
const T& value =
T()) : std::vector<
T, SharedAllocator<
T> >(n, value) { }
53 SharedVector(SharedVector &other) : std::vector<
T, SharedAllocator<
T> >(&other) { }
T * shared_alloc0(std::size_t n)
ThreadState * createThread(void *(*thread_func)(ThreadState *, void *), void *arg)
void * joinThread(ThreadState *ts)
T * shared_alloc(std::size_t n)
void *(* ThreadFunc)(ThreadState *, void *)