00001 /* Gearman server and library 00002 * Copyright (C) 2008 Brian Aker, Eric Day 00003 * All rights reserved. 00004 * 00005 * Use and distribution licensed under the BSD license. See 00006 * the COPYING file in the parent directory for full text. 00007 */ 00008 00014 #ifndef __GEARMAND_THREAD_H__ 00015 #define __GEARMAND_THREAD_H__ 00016 00017 #ifdef __cplusplus 00018 extern "C" { 00019 #endif 00020 00030 struct gearmand_thread_st 00031 { 00032 gearmand_thread_options_t options; 00033 uint32_t count; 00034 uint32_t dcon_count; 00035 uint32_t dcon_add_count; 00036 uint32_t free_dcon_count; 00037 int wakeup_fd[2]; 00038 gearmand_thread_st *next; 00039 gearmand_thread_st *prev; 00040 gearmand_st *gearmand; 00041 struct event_base *base; 00042 gearmand_con_st *dcon_list; 00043 gearmand_con_st *dcon_add_list; 00044 gearmand_con_st *free_dcon_list; 00045 gearman_server_thread_st server_thread; 00046 struct event wakeup_event; 00047 pthread_t id; 00048 pthread_mutex_t lock; 00049 }; 00050 00057 GEARMAN_API 00058 gearman_return_t gearmand_thread_create(gearmand_st *gearmand); 00059 00064 GEARMAN_API 00065 void gearmand_thread_free(gearmand_thread_st *thread); 00066 00073 GEARMAN_API 00074 void gearmand_thread_wakeup(gearmand_thread_st *thread, 00075 gearmand_wakeup_t wakeup); 00076 00082 GEARMAN_API 00083 void gearmand_thread_run(gearmand_thread_st *thread); 00084 00087 #ifdef __cplusplus 00088 } 00089 #endif 00090 00091 #endif /* __GEARMAND_THREAD_H__ */