MirOS Manual: kthread(9), kthread_create(9), kthread_create_deferred(9), kthread_exit(9)

KTHREAD(9)                    BSD Kernel Manual                     KTHREAD(9)


     kthread_create, kthread_exit, kthread_create_deferred - kernel threads


     #include <sys/kthread.h>

     kthread_create(void (*func)(void *), void *arg, struct proc **newpp,
             const char *fmt, ...);

     kthread_exit(int ecode);

     kthread_create_deferred(void (*func)(void *), void *arg);


     Kernel threads are system light-weight processes: cloned from process 0
     (the swapper), sharing its memory map and limits, but with a copy of its
     file descriptor table. They don't receive broadcast nor group signals and
     they can't be swapped.

     Any process can call kthread_create() to create a kernel thread. The new
     process starts up executing func with argument arg. If newpp is not NULL,
     it is filled with the address of the new process. fmt and the remaining
     arguments are used to name the process.

     A kernel thread will terminate by calling kthread_exit(), with exit code

     Since the system has to be up and running for creating new processes,
     device drivers that want to create kernel threads early (e.g., at attach
     time) may use kthread_create_deferred() instead. The system will call
     back the function func with argument arg when it can create threads, so
     it is up to func to call kthread_create() at that point.


     Upon successful completion, kthread_create() returns 0. Otherwise, the
     following error values are returned:

     [EAGAIN]  The limit on the total number of system processes would be ex-




     There is currently no way to use ecode to any sensible purpose from

MirOS BSD #10-current         September 1, 1999                              1

Generated on 2015-07-19 22:36:15 by $MirOS: src/scripts/roff2htm,v 1.80 2015/01/02 13:54:19 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002–2015 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.