server_thread_set_wchan()

void server_thread_set_wchan(server_thread_t *thread, int wchan)

This is a simple function for worker threads to set a string describing the context of what they are currently doing.

It is wise to surround potentially timely operations with calls to this function that set the "wait channel" to a useful string via integer index into the wchans array provided to server_thread_pool_new(), then unset the wchan by calling it again with -1 when the section ends.

The thread argument is the thread object that gets passed as the first argument to the worker function. This function is intended to be used in your worker functions to assist in profiling, debugging, and troubleshooting by both the programmer and administrator. These wchans are something that gets printed by ServerKit when reporting statistics, for every thread in every pool.

This function is also the primary reason the thread object is passed to the worker function.



2007-12-06