MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / thread_init

Function thread_init

src/util/thpool/thpool.c:359–372  ·  view source on GitHub ↗

Initialize a thread in the thread pool * * @param thread address to the pointer of the thread to be created * @param id id to be given to the thread * @return 0 on success, -1 otherwise. */

Source from the content-addressed store, hash-verified

357 * @return 0 on success, -1 otherwise.
358 */
359static int thread_init(thpool_* thpool_p, struct thread **thread_p, int id) {
360
361 *thread_p = (struct thread *)rm_calloc(1, sizeof(struct thread));
362 if(thread_p == NULL) {
363 err("thread_init(): Could not allocate memory for thread\n");
364 return -1;
365 }
366
367 (*thread_p)->thpool_p = thpool_p;
368 (*thread_p)->id = id;
369
370 pthread_create(&(*thread_p)->pthread, NULL, (void *)thread_do, (*thread_p));
371 return 0;
372}
373
374/* Sets the calling thread on hold */
375static void thread_hold(int sig_id) {

Callers 1

thpool_initFunction · 0.85

Calls 1

rm_callocFunction · 0.85

Tested by

no test coverage detected