Server Thread Handling
Detailed Description
This is the interface gearman servers should use for creating threads.
Define Documentation
#define GEARMAN_SERVER_THREAD_LOCK |
( |
__thread |
|
) |
|
Value:{ \
if ((__thread)->server->thread_count > 1) \
(void) pthread_mutex_lock(&((__thread)->lock)); \
}
Lock only if we are multi-threaded.
Definition at line 187 of file common.h.
#define GEARMAN_SERVER_THREAD_UNLOCK |
( |
__thread |
|
) |
|
Value:{ \
if ((__thread)->server->thread_count > 1) \
(void) pthread_mutex_unlock(&((__thread)->lock)); \
}
Unlock only if we are multi-threaded.
Definition at line 196 of file common.h.
Enumeration Type Documentation
Function Documentation
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.
Free resources used by a thread structure.
- Parameters:
-
| thread | Thread structure previously initialized with gearman_server_thread_create. |
Definition at line 125 of file thread.c.
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 160 of file thread.c.
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 165 of file thread.c.
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 170 of file thread.c.
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 185 of file thread.c.
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 177 of file thread.c.
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 196 of file thread.c.