Gearman Developer Documentation

libgearman-server/gearmand_thread.h
Go to the documentation of this file.
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   bool is_thread_lock;
00033   bool is_wakeup_event;
00034   uint32_t count;
00035   uint32_t dcon_count;
00036   uint32_t dcon_add_count;
00037   uint32_t free_dcon_count;
00038   int wakeup_fd[2];
00039   gearmand_thread_st *next;
00040   gearmand_thread_st *prev;
00041   gearmand_st *gearmand;
00042   struct event_base *base;
00043   gearmand_con_st *dcon_list;
00044   gearmand_con_st *dcon_add_list;
00045   gearmand_con_st *free_dcon_list;
00046   gearman_server_thread_st server_thread;
00047   struct event wakeup_event;
00048   pthread_t id;
00049   pthread_mutex_t lock;
00050 };
00051 
00058 GEARMAN_API
00059 gearman_return_t gearmand_thread_create(gearmand_st *gearmand);
00060 
00065 GEARMAN_API
00066 void gearmand_thread_free(gearmand_thread_st *thread);
00067 
00074 GEARMAN_API
00075 void gearmand_thread_wakeup(gearmand_thread_st *thread,
00076                             gearmand_wakeup_t wakeup);
00077 
00083 GEARMAN_API
00084 void gearmand_thread_run(gearmand_thread_st *thread);
00085 
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091 
00092 #endif /* __GEARMAND_THREAD_H__ */