File: create_new_thread_extension.h

package info (click to toggle)
concurrentqueue 1.0.3%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,648 kB
  • sloc: cpp: 37,303; makefile: 88; ansic: 67; python: 46; sh: 18
file content (46 lines) | stat: -rw-r--r-- 1,111 bytes parent folder | download | duplicates (11)
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
// Copyright (C) 2006  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#ifndef DLIB_CREATE_NEW_THREAD_EXTENSIOn_
#define DLIB_CREATE_NEW_THREAD_EXTENSIOn_ 

#include "threads_kernel_abstract.h"
#include "create_new_thread_extension_abstract.h"
#include "../threads.h"

namespace dlib
{

// ----------------------------------------------------------------------------------------

    template <
        typename T,
        void (T::*funct)()
        >
    inline void dlib_create_new_thread_helper (
        void* obj
    )
    {
        T* o = static_cast<T*>(obj);
        (o->*funct)();
    }

// ----------------------------------------------------------------------------------------

    template <
        typename T,
        void (T::*funct)()
        >
    inline bool create_new_thread (
        T& obj
    )
    {
        return create_new_thread(dlib_create_new_thread_helper<T,funct>,&obj);
    }

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_CREATE_NEW_THREAD_EXTENSIOn_