MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / pthread_create

Function pthread_create

mysys/my_winthread.c:66–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65
66int pthread_create(pthread_t *thread_id, const pthread_attr_t *attr,
67 pthread_handler func, void *param)
68{
69 uintptr_t handle;
70 struct thread_start_parameter *par;
71 unsigned int stack_size;
72 int error_no;
73 DBUG_ENTER("pthread_create");
74
75 par= (struct thread_start_parameter *)malloc(sizeof(*par));
76 if (!par)
77 goto error_return;
78
79 par->func= func;
80 par->arg= param;
81 stack_size= attr?attr->dwStackSize:0;
82
83 handle= _beginthreadex(NULL, stack_size , pthread_start, par, 0, thread_id);
84 if (!handle)
85 goto error_return;
86 DBUG_PRINT("info", ("thread id=%u",*thread_id));
87
88 /* Do not need thread handle, close it */
89 CloseHandle((HANDLE)handle);
90 DBUG_RETURN(0);
91
92error_return:
93 error_no= errno;
94 DBUG_PRINT("error",
95 ("Can't create thread to handle request (error %d)",error_no));
96 DBUG_RETURN(error_no);
97}
98
99
100void pthread_exit(void *a)

Callers 5

start_helper_threadFunction · 0.85
sigwaitFunction · 0.85
spawn_thread_noopFunction · 0.85
start_helper_threadFunction · 0.85
start_threadFunction · 0.85

Calls

no outgoing calls

Tested by 1

start_threadFunction · 0.68