Lines Matching refs:task

10 static char *nxt_fiber_create_stack(nxt_task_t *task, nxt_fiber_t *fib);
12 static void nxt_fiber_switch_handler(nxt_task_t *task, void *obj, void *data);
13 static void nxt_fiber_switch(nxt_task_t *task, nxt_fiber_t *fib);
14 static void nxt_fiber_timer_handler(nxt_task_t *task, void *obj, void *data);
17 #define nxt_fiber_enqueue(thr, task, fib) \ argument
19 nxt_fiber_switch_handler, task, fib, NULL)
68 fib->task.thread = thr; in nxt_fiber_create()
69 fib->task.log = thr->log; in nxt_fiber_create()
70 fib->task.ident = nxt_task_next_ident(); in nxt_fiber_create()
72 nxt_debug(&fib->task, "fiber create cached: %PF", fib->fid); in nxt_fiber_create()
74 nxt_fiber_enqueue(thr, &fm->engine->task, fib); in nxt_fiber_create()
92 fib->task.thread = thr; in nxt_fiber_create()
93 fib->task.log = thr->log; in nxt_fiber_create()
94 fib->task.ident = nxt_task_next_ident(); in nxt_fiber_create()
96 fib->stack = nxt_fiber_create_stack(&fib->task, fib); in nxt_fiber_create()
124 nxt_fiber_create_stack(nxt_task_t *task, nxt_fiber_t *fib) in nxt_fiber_create_stack() argument
135 nxt_alert(task, "fiber stack " in nxt_fiber_create_stack()
143 nxt_alert(task, "fiber stack mprotect(%uz, PROT_NONE) failed %E", in nxt_fiber_create_stack()
151 nxt_debug(task, "fiber stack mmap: %p", s); in nxt_fiber_create_stack()
159 nxt_fiber_create_stack(nxt_task_t *task, nxt_fiber_t *fib) in nxt_fiber_create_stack() argument
169 nxt_alert(task, "fiber stack mmap(%uz, MAP_PRIVATE|MAP_ANON) failed %E", in nxt_fiber_create_stack()
176 nxt_alert(task, "fiber stack mprotect(%uz, PROT_NONE) failed %E", in nxt_fiber_create_stack()
184 nxt_debug(task, "fiber stack mmap: %p", s); in nxt_fiber_create_stack()
208 nxt_debug(&fib->task, "fiber switch to stack: %p", fib->stack); in nxt_fiber_switch_stack()
211 nxt_alert(&fib->task, "getcontext() failed"); in nxt_fiber_switch_stack()
227 nxt_alert(&fib->task, "setcontext() failed"); in nxt_fiber_switch_stack()
235 nxt_task_t *task; in nxt_fiber_trampoline() local
241 task = &fib->task; in nxt_fiber_trampoline()
244 nxt_debug(task, "fiber return to parent stack"); in nxt_fiber_trampoline()
246 nxt_fiber_enqueue(task->thread, task, fib); in nxt_fiber_trampoline()
253 nxt_debug(task, "fiber start"); in nxt_fiber_trampoline()
257 nxt_fiber_exit(task, &fib->main->fiber, NULL); in nxt_fiber_trampoline()
274 nxt_debug(&fib->task, "fiber switch to stack: %p", fib->stack); in nxt_fiber_switch_stack()
277 nxt_alert(&fib->task, "getcontext() failed"); in nxt_fiber_switch_stack()
292 nxt_alert(&fib->task, "setcontext() failed"); in nxt_fiber_switch_stack()
300 nxt_task_t *task; in nxt_fiber_trampoline() local
302 task = &fib->task; in nxt_fiber_trampoline()
305 nxt_debug(task, "fiber return to parent stack"); in nxt_fiber_trampoline()
307 nxt_fiber_enqueue(task->thread, task, fib); in nxt_fiber_trampoline()
314 nxt_debug(task, "fiber start"); in nxt_fiber_trampoline()
318 nxt_fiber_exit(task, &fib->main->fiber, NULL); in nxt_fiber_trampoline()
331 nxt_fiber_switch_handler(nxt_task_t *task, void *obj, void *data) in nxt_fiber_switch_handler() argument
337 nxt_fiber_switch(task, fib); in nxt_fiber_switch_handler()
343 nxt_fiber_switch(nxt_task_t *task, nxt_fiber_t *fib) in nxt_fiber_switch() argument
345 nxt_debug(task, "fiber switch: %PF", fib->fid); in nxt_fiber_switch()
347 task->thread->fiber = fib; in nxt_fiber_switch()
363 nxt_fiber_yield(nxt_task_t *task) in nxt_fiber_yield() argument
367 fib = task->thread->fiber; in nxt_fiber_yield()
371 nxt_debug(task, "fiber yield"); in nxt_fiber_yield()
373 nxt_fiber_enqueue(task->thread, &fib->main->engine->task, fib); in nxt_fiber_yield()
375 nxt_fiber_switch(task, &fib->main->fiber); in nxt_fiber_yield()
380 nxt_debug(task, "fiber yield return"); in nxt_fiber_yield()
385 nxt_fiber_sleep(nxt_task_t *task, nxt_msec_t timeout) in nxt_fiber_sleep() argument
389 fib = task->thread->fiber; in nxt_fiber_sleep()
391 fib->timer.work_queue = &task->thread->engine->fast_work_queue; in nxt_fiber_sleep()
395 task = &fib->task; in nxt_fiber_sleep()
397 nxt_timer_add(task->thread->engine, &fib->timer, timeout); in nxt_fiber_sleep()
401 nxt_debug(task, "fiber sleep: %T", timeout); in nxt_fiber_sleep()
403 nxt_fiber_switch(task, &fib->main->fiber); in nxt_fiber_sleep()
408 nxt_debug(task, "fiber sleep return"); in nxt_fiber_sleep()
413 nxt_fiber_timer_handler(nxt_task_t *task, void *obj, void *data) in nxt_fiber_timer_handler() argument
420 nxt_debug(task, "fiber timer handler"); in nxt_fiber_timer_handler()
424 nxt_fiber_switch(task, fib); in nxt_fiber_timer_handler()
431 nxt_fiber_wait(nxt_task_t *task) in nxt_fiber_wait() argument
435 fib = task->thread->fiber; in nxt_fiber_wait()
438 nxt_debug(task, "fiber wait"); in nxt_fiber_wait()
440 nxt_fiber_switch(task, &fib->main->fiber); in nxt_fiber_wait()
445 nxt_debug(task, "fiber wait return"); in nxt_fiber_wait()
450 nxt_fiber_exit(nxt_task_t *task, nxt_fiber_t *next, void *data) in nxt_fiber_exit() argument
454 fib = task->thread->fiber; in nxt_fiber_exit()
456 nxt_debug(task, "fiber exit"); in nxt_fiber_exit()
462 nxt_fiber_switch(task, next); in nxt_fiber_exit()