1 /* 2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client 3 * Copyright (C) 2005-2012 DINH Viet Hoa and the Claws Mail team 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef ETPAN_THREAD_MANAGER_TYPES_H 21 22 #define ETPAN_THREAD_MANAGER_TYPES_H 23 24 #include <pthread.h> 25 #include <libetpan/libetpan.h> 26 27 struct etpan_thread_manager { 28 /* thread pool */ 29 carray * thread_pool; 30 carray * thread_pending; 31 int can_create_thread; 32 33 int unbound_count; 34 35 int notify_fds[2]; 36 }; 37 38 struct etpan_thread { 39 struct etpan_thread_manager * manager; 40 41 pthread_t th_id; 42 43 pthread_mutex_t lock; 44 carray * op_list; 45 carray * op_done_list; 46 47 int bound_count; 48 int terminate_state; 49 50 struct mailsem * start_sem; 51 struct mailsem * stop_sem; 52 struct mailsem * op_sem; 53 }; 54 55 struct etpan_thread_op { 56 struct etpan_thread * thread; 57 58 void (* run)(struct etpan_thread_op * op); 59 60 void (* callback)(int cancelled, void * result, void * callback_data); 61 void * callback_data; 62 63 void (* cleanup)(struct etpan_thread_op * op); 64 65 pthread_mutex_t lock; 66 int callback_called; 67 int cancellable; 68 int cancelled; 69 void * param; 70 void * result; 71 int finished; 72 mailimap *imap; 73 newsnntp *nntp; 74 }; 75 76 #endif 77