Gearman Developer Documentation

Thread Declarations
[Gearman Server Declarations]

Data Structures

struct  gearman_server_thread_st

Functions

gearman_server_thread_stgearman_server_thread_create (gearman_server_st *server, gearman_server_thread_st *thread)
void gearman_server_thread_free (gearman_server_thread_st *thread)
const char * gearman_server_thread_error (gearman_server_thread_st *thread)
int gearman_server_thread_errno (gearman_server_thread_st *thread)
void gearman_server_thread_set_event_watch (gearman_server_thread_st *thread, gearman_event_watch_fn *event_watch, void *event_watch_arg)
void gearman_server_thread_set_log_fn (gearman_server_thread_st *thread, gearman_log_fn *function, void *context, gearman_verbose_t verbose)
void gearman_server_thread_set_run (gearman_server_thread_st *thread, gearman_server_thread_run_fn *run_fn, void *run_arg)
gearman_server_con_stgearman_server_thread_run (gearman_server_thread_st *thread, gearman_return_t *ret_ptr)

Detailed Description

This is the interface gearman servers should use for creating threads.


Function Documentation

gearman_server_thread_st* gearman_server_thread_create ( gearman_server_st server,
gearman_server_thread_st thread 
)

Initialize a thread structure. This cannot fail if the caller supplies a thread structure.

Parameters:
server Server structure previously initialized with gearman_server_create.
thread Caller allocated thread structure, or NULL to allocate one.
Returns:
Pointer to an allocated thread structure if thread parameter was NULL, or the thread parameter pointer if it was not NULL.

Definition at line 63 of file thread.c.

void gearman_server_thread_free ( gearman_server_thread_st thread  ) 

Free resources used by a thread structure.

Parameters:
thread Thread structure previously initialized with gearman_server_thread_create.

Definition at line 126 of file thread.c.

const char* gearman_server_thread_error ( gearman_server_thread_st thread  ) 

Return an error string for the last error encountered.

Parameters:
thread Thread structure previously initialized with gearman_server_thread_create.
Returns:
Pointer to static buffer in library that holds an error string.

Definition at line 161 of file thread.c.

int gearman_server_thread_errno ( gearman_server_thread_st thread  ) 

Value of errno in the case of a GEARMAN_ERRNO return value.

Parameters:
thread Thread structure previously initialized with gearman_server_thread_create.
Returns:
An errno value as defined in your system errno.h file.

Definition at line 166 of file thread.c.

void gearman_server_thread_set_event_watch ( gearman_server_thread_st thread,
gearman_event_watch_fn event_watch,
void *  event_watch_arg 
)

Set custom I/O event watch callback.

Parameters:
thread Thread structure previously initialized with gearman_server_thread_create.
event_watch Function to be called when events need to be watched.
event_watch_arg Argument to pass along to event_watch.

Definition at line 171 of file thread.c.

void gearman_server_thread_set_log_fn ( gearman_server_thread_st thread,
gearman_log_fn function,
void *  context,
gearman_verbose_t  verbose 
)

Set logging callback for server thread instance.

Parameters:
thread Thread structure previously initialized with gearman_server_thread_create.
function Function to call when there is a logging message.
context Argument to pass into the log callback function.
verbose Verbosity level.

Definition at line 186 of file thread.c.

void gearman_server_thread_set_run ( gearman_server_thread_st thread,
gearman_server_thread_run_fn run_fn,
void *  run_arg 
)

Set thread run callback.

Parameters:
thread Thread structure previously initialized with gearman_server_thread_create.
run_fn Function to call when thread should be run.
run_arg Argument to pass along with run_fn.

Definition at line 178 of file thread.c.

gearman_server_con_st* gearman_server_thread_run ( gearman_server_thread_st thread,
gearman_return_t ret_ptr 
)

Process server thread connections.

Parameters:
thread Thread structure previously initialized with gearman_server_thread_create.
ret_ptr Pointer to hold a standard gearman return value.
Returns:
On error, the server connection that encountered the error.

Definition at line 197 of file thread.c.

Generated on Tue Jun 15 11:40:21 2010 by  doxygen 1.6.3