Changeset 3762
- Timestamp:
- 09/11/08 18:26:35
- Files:
-
- releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/camel-provider.c (modified) (1 diff)
- releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/camel-provider.h (modified) (3 diffs)
- releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/camel.c (modified) (1 diff)
- releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-provider.c (modified) (1 diff)
- releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-provider.c (modified) (2 diffs)
- releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c (modified) (9 diffs)
- releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/camel-provider.c
r3714 r3762 270 270 } 271 271 272 void camel_provider_shutdown (CamelProvider *provider)273 {274 if (provider->shutdown) {275 provider->shutdown ((CamelObject *) provider);276 }277 }278 279 void camel_provider_shutdown_all (void)280 {281 GList *providers_list;282 GList *node;283 284 providers_list = camel_provider_list (FALSE);285 for (node = providers_list; node != NULL; node = g_list_next (node)) {286 CamelProvider *provider = (CamelProvider *) node->data;287 camel_provider_shutdown (provider);288 }289 g_list_free (providers_list);290 }291 292 272 static gint 293 273 provider_compare (gconstpointer a, gconstpointer b) releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/camel-provider.h
r3714 r3762 145 145 146 146 typedef int (*CamelProviderAutoDetectFunc) (CamelURL *url, GHashTable **auto_detected, CamelException *ex); 147 typedef void (*CamelProviderShutdownFunc) (CamelObject *provider);148 149 147 150 148 typedef struct { … … 211 209 const char *license_file; 212 210 213 /* Shutdown function. Will be called in camel_shutdown.214 */215 CamelProviderShutdownFunc shutdown;216 217 211 /* Private to the provider */ 218 212 void *priv; … … 231 225 void camel_provider_load(const char *path, CamelException *ex); 232 226 void camel_provider_register(CamelProvider *provider); 233 void camel_provider_shutdown (CamelProvider *provider);234 void camel_provider_shutdown_all (void);235 227 GList *camel_provider_list(gboolean load); 236 228 CamelProvider *camel_provider_get(const char *url_string, CamelException *ex); releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/camel.c
r3719 r3762 54 54 if (!initialised) 55 55 return; 56 57 camel_provider_shutdown_all ();58 56 59 57 initialised = FALSE; releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-provider.c
r3714 r3762 114 114 imap_provider.authtypes = g_list_prepend (imap_provider.authtypes, &camel_imap_password_authtype); 115 115 imap_provider.translation_domain = GETTEXT_PACKAGE; 116 imap_provider.shutdown = NULL;117 116 118 117 camel_provider_register(&imap_provider); releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-provider.c
r3714 r3762 90 90 }; 91 91 92 static void93 pop3_shutdown (CamelProvider *provider)94 {95 camel_pop3_store_kill_threads ();96 }97 98 92 void 99 93 camel_provider_module_init(void) … … 112 106 pop3_provider.authtypes = g_list_prepend(pop3_provider.authtypes, &camel_pop3_password_authtype); 113 107 pop3_provider.translation_domain = GETTEXT_PACKAGE; 114 pop3_provider.shutdown = pop3_shutdown;115 108 116 109 camel_provider_register(&pop3_provider); releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c
r3714 r3762 84 84 85 85 static CamelStoreClass *parent_class = NULL; 86 static GMutex *wait_for_login_mutex = NULL;87 static GCond *wait_for_login_cond = NULL;88 static GList *wait_for_login_threads = NULL;89 86 90 87 static void finalize (CamelObject *object); … … 178 175 } 179 176 180 g_static_rec_mutex_unlock (store->eng_lock);181 182 177 g_timeout_add (20000, unref_it, store->engine); 183 178 store->engine = NULL; 179 g_static_rec_mutex_unlock (store->eng_lock); 184 180 185 181 /* camel_object_unref((CamelObject *)store->engine); */ … … 408 404 g_static_rec_mutex_unlock (store->eng_lock); 409 405 410 g_mutex_lock (wait_for_login_mutex);411 406 while (!killed) { 412 GTimeVal tv_delay = {0, 0}; 413 414 tv_delay.tv_sec = login_delay; 415 416 g_cond_timed_wait (wait_for_login_cond, wait_for_login_mutex, &tv_delay); 417 418 if (!store->engine) { 419 break; 420 } 407 408 sleep (login_delay); 409 421 410 422 411 if (!store->is_refreshing) { … … 434 423 435 424 camel_object_unref (store); 436 wait_for_login_threads = g_list_append (wait_for_login_threads, store->login_delay_thread);437 g_mutex_unlock (wait_for_login_mutex);438 425 return NULL; 439 426 } … … 934 921 camel_pop3_store_prepare (CamelStore *store) 935 922 { 936 CamelPOP3Store *pstore = (CamelPOP3Store *) store;937 923 camel_object_ref (store); 938 g_mutex_lock (wait_for_login_mutex); 939 pstore->login_delay_thread = g_thread_create (wait_for_login_delay, store, TRUE, NULL); 940 g_mutex_unlock (wait_for_login_mutex); 924 g_thread_create (wait_for_login_delay, store, FALSE, NULL); 941 925 } 942 926 … … 1036 1020 1037 1021 g_timeout_add (20000, unref_it, store->engine); 1022 /* camel_object_unref((CamelObject *)store->engine); */ 1038 1023 store->engine = NULL; 1024 1039 1025 //g_static_rec_mutex_unlock (store->eng_lock); 1040 1026 … … 1214 1200 } 1215 1201 1216 void1217 camel_pop3_store_kill_threads (void)1218 {1219 GThread *thread_to_join;1220 g_mutex_lock (wait_for_login_mutex);1221 while (wait_for_login_threads) {1222 thread_to_join = wait_for_login_threads->data;1223 g_cond_broadcast (wait_for_login_cond);1224 g_mutex_unlock (wait_for_login_mutex);1225 g_thread_join (thread_to_join);1226 g_mutex_lock (wait_for_login_mutex);1227 wait_for_login_threads = g_list_remove (wait_for_login_threads, thread_to_join);1228 }1229 g_mutex_unlock (wait_for_login_mutex);1230 }1231 1232 1202 static void 1233 1203 camel_pop3_store_class_init (CamelPOP3StoreClass *camel_pop3_store_class) … … 1241 1211 1242 1212 parent_class = CAMEL_STORE_CLASS (camel_type_get_global_classfuncs (camel_disco_store_get_type ())); 1243 wait_for_login_mutex = g_mutex_new ();1244 wait_for_login_cond = g_cond_new ();1245 wait_for_login_threads = NULL;1246 1213 1247 1214 /* virtual method overload */ … … 1289 1256 store->uidl_lock = g_new0 (GStaticRecMutex, 1); 1290 1257 g_static_rec_mutex_init (store->uidl_lock); 1291 store->login_delay_thread = NULL;1292 1258 1293 1259 return; releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.h
r3714 r3762 54 54 gpointer book; 55 55 guint login_delay; 56 GThread *login_delay_thread;57 56 58 57 GPtrArray *uids; … … 80 79 81 80 void camel_pop3_store_destroy_lists (CamelPOP3Store *pop3_store); 82 void camel_pop3_store_kill_threads (void);83 81 84 82 G_END_DECLS
