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

Function thpool_add_work

src/util/thpool/thpool.c:172–189  ·  view source on GitHub ↗

Add work to the thread pool */

Source from the content-addressed store, hash-verified

170
171/* Add work to the thread pool */
172int thpool_add_work(thpool_* thpool_p, void (*function_p)(void *), void *arg_p) {
173 job *newjob;
174
175 newjob = (struct job *)rm_calloc(1, sizeof(struct job));
176 if(newjob == NULL) {
177 err("thpool_add_work(): Could not allocate memory for new job\n");
178 return -1;
179 }
180
181 /* add function and argument */
182 newjob->function = function_p;
183 newjob->arg = arg_p;
184
185 /* add job to queue */
186 jobqueue_push(&thpool_p->jobqueue, newjob);
187
188 return 0;
189}
190
191/* Wait until all jobs have finished */
192void thpool_wait(thpool_* thpool_p) {

Callers 2

Calls 2

rm_callocFunction · 0.85
jobqueue_pushFunction · 0.85

Tested by

no test coverage detected