MCPcopy Create free account
hub / github.com/davisking/dlib / spawn_thread

Function spawn_thread

dlib/threads/threads_kernel_1.cpp:53–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 // -----------------------------------------------------------------------------------
52
53 bool spawn_thread (
54 void (*funct)(void*),
55 void* param
56 )
57 {
58 info* p;
59 try { p = new info; }
60 catch (...) { return false; }
61
62 p->funct = funct;
63 p->param = param;
64
65
66 unsigned int garbage;
67
68 HANDLE thandle = (HANDLE)_beginthreadex (NULL,0,thread_starter,p,0,&garbage);
69 // make thread and add it to the pool
70
71 // return false if _beginthreadex didn't work
72 if ( thandle == 0)
73 {
74 delete p;
75 return false;
76 }
77
78 // throw away the thread handle
79 CloseHandle(thandle);
80 return true;
81 }
82
83 // -----------------------------------------------------------------------------------
84

Callers 1

create_new_threadMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected