NAME
Worker, getworker, workerdebug – auxiliary worker threads |
SYNOPSIS
#include <u.h> #include <libc.h> #include <thread.h> #include <worker.h>
typedef char* (*Worker)(void *arg, void **aux); |
DESCRIPTION
This library provices a pool of worker threads to handle user
requests. Worker threads are created on demand and never destroyed.
Idle workers are kept around waiting for more busy times. Getworker allocates a new worker to perform work on the given arg , as supplied by the caller. If rc is non null, the result value of work is sent through it upon completion. The argument aux given to work points to a per–worker storage area that may hold a single pointer. This is useful, for example, to keep reply channels cached.
The global workerthreadcreate is used to create new worker thread.
By default, it is initialized to threadcreate (2). Initialize
with the address of proccreate to create worker processes instead
of threads. The stack size is mainstacksize . |
SOURCE
/sys/src/libworker |
BUGS
This is a new library and is expected to evolve. |