Changeset 2521
- Timestamp:
- 07/27/07 18:44:34
- Files:
-
- devel/pvanhoof/sessionwork/ChangeLog (modified) (1 diff)
- devel/pvanhoof/sessionwork/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-engine.c (modified) (5 diffs)
- devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-folder.c (modified) (28 diffs)
- devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-store-account.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/pvanhoof/sessionwork/ChangeLog
r2513 r2521 11 11 a callback rather than a GError. In the callback you can know about 12 12 when the account got connected and if not, why it failed 13 14 * Cond locks in the queues of the store accounts while the callbacks 15 are happening. This is a significant policy change in locking 16 behaviour that should be well tested. 13 17 14 18 * This was a major API change in TnyAccount devel/pvanhoof/sessionwork/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-engine.c
r2517 r2521 336 336 g_static_rec_mutex_lock (pe->lock); 337 337 338 camel_object_ref (pe); 339 338 340 if (pcwait && pcwait->state >= CAMEL_POP3_COMMAND_OK) { 341 camel_object_unref (pe); 342 339 343 g_static_rec_mutex_unlock (pe->lock); 340 344 return 0; … … 343 347 pc = pe->current; 344 348 if (pc == NULL) { 349 camel_object_unref (pe); 345 350 g_static_rec_mutex_unlock (pe->lock); 346 351 return 0; … … 432 437 if (have_err) 433 438 camel_service_disconnect (CAMEL_SERVICE (pe->store), FALSE, &ex); 439 440 camel_object_unref (pe); 434 441 g_static_rec_mutex_unlock (pe->lock); 435 442 return 0; … … 439 446 camel_service_disconnect (CAMEL_SERVICE (pe->store), FALSE, &ex); 440 447 448 camel_object_unref (pe); 441 449 g_static_rec_mutex_unlock (pe->lock); 442 450 … … 465 473 camel_service_disconnect (CAMEL_SERVICE (pe->store), FALSE, &ex); 466 474 475 camel_object_unref (pe); 467 476 g_static_rec_mutex_unlock (pe->lock); 468 477 devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-folder.c
r2510 r2521 934 934 GError *err; 935 935 TnySessionCamel *session; 936 937 GCond* condition; 938 gboolean had_callback; 939 GMutex *mutex; 940 936 941 } SyncFolderInfo; 937 942 … … 955 960 tny_idle_stopper_destroy (info->stopper); 956 961 info->stopper = NULL; 957 958 g_slice_free (SyncFolderInfo, thr_user_data); 962 963 g_mutex_lock (info->mutex); 964 g_cond_broadcast (info->condition); 965 info->had_callback = TRUE; 966 g_mutex_unlock (info->mutex); 959 967 960 968 return; … … 1051 1059 1052 1060 g_static_rec_mutex_unlock (priv->folder_lock); 1061 1062 info->mutex = g_mutex_new (); 1063 info->condition = g_cond_new (); 1064 info->had_callback = FALSE; 1053 1065 1054 1066 if (info->callback) … … 1061 1073 _tny_camel_folder_unreason (priv); 1062 1074 } 1075 1076 /* Wait on the queue for the mainloop callback to be finished */ 1077 g_mutex_lock (info->mutex); 1078 if (!info->had_callback) 1079 g_cond_wait (info->condition, info->mutex); 1080 g_mutex_unlock (info->mutex); 1081 1082 g_mutex_free (info->mutex); 1083 g_cond_free (info->condition); 1084 1085 g_slice_free (SyncFolderInfo, thr_user_data); 1063 1086 1064 1087 return NULL; … … 1148 1171 GError *err; 1149 1172 TnySessionCamel *session; 1173 1174 GCond* condition; 1175 gboolean had_callback; 1176 GMutex *mutex; 1177 1150 1178 } RefreshFolderInfo; 1151 1179 … … 1172 1200 tny_idle_stopper_destroy (info->stopper); 1173 1201 info->stopper = NULL; 1174 1175 g_slice_free (RefreshFolderInfo, thr_user_data); 1202 1203 g_mutex_lock (info->mutex); 1204 g_cond_broadcast (info->condition); 1205 info->had_callback = TRUE; 1206 g_mutex_unlock (info->mutex); 1176 1207 1177 1208 return; … … 1269 1300 } 1270 1301 1271 1272 1302 g_static_rec_mutex_unlock (priv->folder_lock); 1303 1304 info->mutex = g_mutex_new (); 1305 info->condition = g_cond_new (); 1306 info->had_callback = FALSE; 1273 1307 1274 1308 if (info->callback) … … 1281 1315 _tny_camel_folder_unreason (priv); 1282 1316 } 1317 1318 /* Wait on the queue for the mainloop callback to be finished */ 1319 g_mutex_lock (info->mutex); 1320 if (!info->had_callback) 1321 g_cond_wait (info->condition, info->mutex); 1322 g_mutex_unlock (info->mutex); 1323 1324 g_mutex_free (info->mutex); 1325 g_cond_free (info->condition); 1326 g_slice_free (RefreshFolderInfo, info); 1283 1327 1284 1328 return NULL; … … 1563 1607 TnyIdleStopper *stopper; 1564 1608 gboolean cancelled; 1609 1610 GCond* condition; 1611 gboolean had_callback; 1612 GMutex *mutex; 1613 1565 1614 } GetMsgInfo; 1566 1615 … … 1594 1643 info->stopper = NULL; 1595 1644 1596 g_slice_free (GetMsgInfo, info); 1645 g_mutex_lock (info->mutex); 1646 g_cond_broadcast (info->condition); 1647 info->had_callback = TRUE; 1648 g_mutex_unlock (info->mutex); 1649 1650 return; 1597 1651 } 1598 1652 … … 1675 1729 info->err = g_error_copy ((const GError *) err); 1676 1730 if (info->msg && G_IS_OBJECT (info->msg)) 1677 g_object_unref ( G_OBJECT (info->msg));1731 g_object_unref (info->msg); 1678 1732 info->msg = NULL; 1679 1733 } else 1680 1734 info->err = NULL; 1681 1735 1682 g_object_unref (G_OBJECT (info->header)); 1736 g_object_unref (info->header); 1737 1738 info->mutex = g_mutex_new (); 1739 info->condition = g_cond_new (); 1740 info->had_callback = FALSE; 1683 1741 1684 1742 if (info->callback) … … 1689 1747 } else {/* thread reference */ 1690 1748 _tny_camel_folder_unreason (priv); 1691 g_object_unref (G_OBJECT (info->self)); 1692 } 1693 1749 g_object_unref (info->self); 1750 } 1751 1752 /* Wait on the queue for the mainloop callback to be finished */ 1753 g_mutex_lock (info->mutex); 1754 if (!info->had_callback) 1755 g_cond_wait (info->condition, info->mutex); 1756 g_mutex_unlock (info->mutex); 1757 1758 g_mutex_free (info->mutex); 1759 g_cond_free (info->condition); 1760 1761 g_slice_free (GetMsgInfo, info); 1694 1762 1695 1763 return NULL; … … 2515 2583 gboolean cancelled; 2516 2584 GList *rems, *adds; 2585 2586 GCond* condition; 2587 gboolean had_callback; 2588 GMutex *mutex; 2589 2517 2590 } CopyFolderInfo; 2518 2591 … … 2546 2619 g_free (info->new_name); 2547 2620 2548 g_slice_free (CopyFolderInfo, info); 2621 2622 g_mutex_lock (info->mutex); 2623 g_cond_broadcast (info->condition); 2624 info->had_callback = TRUE; 2625 g_mutex_unlock (info->mutex); 2626 2627 return; 2549 2628 } 2550 2629 … … 2633 2712 g_static_rec_mutex_unlock (priv->folder_lock); 2634 2713 2714 info->mutex = g_mutex_new (); 2715 info->condition = g_cond_new (); 2716 info->had_callback = FALSE; 2717 2635 2718 if (info->callback) 2636 2719 { … … 2641 2724 g_object_unref (info->into); 2642 2725 g_object_unref (info->self); 2643 /* _tny_camel_folder_unreason (priv); */ 2644 } 2726 } 2727 2728 /* Wait on the queue for the mainloop callback to be finished */ 2729 g_mutex_lock (info->mutex); 2730 if (!info->had_callback) 2731 g_cond_wait (info->condition, info->mutex); 2732 g_mutex_unlock (info->mutex); 2733 2734 g_mutex_free (info->mutex); 2735 g_cond_free (info->condition); 2736 2737 g_slice_free (CopyFolderInfo, info); 2645 2738 2646 2739 return NULL; … … 2752 2845 gint to_unread; 2753 2846 gboolean cancelled; 2847 2848 GCond* condition; 2849 gboolean had_callback; 2850 GMutex *mutex; 2851 2754 2852 } TransferMsgsInfo; 2755 2853 … … 2817 2915 info->stopper = NULL; 2818 2916 2819 g_slice_free (TransferMsgsInfo, info); 2917 2918 g_mutex_lock (info->mutex); 2919 g_cond_broadcast (info->condition); 2920 info->had_callback = TRUE; 2921 g_mutex_unlock (info->mutex); 2820 2922 2821 2923 return; … … 3204 3306 info->err = NULL; 3205 3307 3308 3309 info->mutex = g_mutex_new (); 3310 info->condition = g_cond_new (); 3311 info->had_callback = FALSE; 3312 3206 3313 /* Call callback function, if it exists */ 3207 3314 if (info->callback) … … 3218 3325 g_object_unref (G_OBJECT (info->folder_dst)); 3219 3326 } 3327 3328 /* Wait on the queue for the mainloop callback to be finished */ 3329 g_mutex_lock (info->mutex); 3330 if (!info->had_callback) 3331 g_cond_wait (info->condition, info->mutex); 3332 g_mutex_unlock (info->mutex); 3333 3334 g_mutex_free (info->mutex); 3335 g_cond_free (info->condition); 3336 3337 g_slice_free (TransferMsgsInfo, info); 3220 3338 3221 3339 return NULL; … … 3913 4031 TnyFolderStoreQuery *query; 3914 4032 gpointer user_data; 3915 guint depth; TnySessionCamel *session; 4033 guint depth; 4034 TnySessionCamel *session; 4035 4036 GCond* condition; 4037 gboolean had_callback; 4038 GMutex *mutex; 4039 3916 4040 } GetFoldersInfo; 3917 4041 … … 3933 4057 _tny_session_stop_operation (info->session); 3934 4058 3935 g_slice_free (GetFoldersInfo, info); 4059 g_mutex_lock (info->mutex); 4060 g_cond_broadcast (info->condition); 4061 info->had_callback = TRUE; 4062 g_mutex_unlock (info->mutex); 3936 4063 3937 4064 return; … … 3967 4094 if (info->query) 3968 4095 g_object_unref (G_OBJECT (info->query)); 4096 4097 info->mutex = g_mutex_new (); 4098 info->condition = g_cond_new (); 4099 info->had_callback = FALSE; 3969 4100 3970 4101 … … 3980 4111 g_object_unref (G_OBJECT (info->list)); 3981 4112 } 4113 4114 /* Wait on the queue for the mainloop callback to be finished */ 4115 g_mutex_lock (info->mutex); 4116 if (!info->had_callback) 4117 g_cond_wait (info->condition, info->mutex); 4118 g_mutex_unlock (info->mutex); 4119 4120 g_mutex_free (info->mutex); 4121 g_cond_free (info->condition); 4122 4123 g_slice_free (GetFoldersInfo, info); 3982 4124 3983 4125 return NULL; … … 4105 4247 gint unread; 4106 4248 gint total; 4249 4250 GCond* condition; 4251 gboolean had_callback; 4252 GMutex *mutex; 4253 4107 4254 } PokeStatusInfo; 4108 4255 … … 4130 4277 notify_folder_observers_about (self, change); 4131 4278 4279 4132 4280 g_object_unref (change); 4133 4281 … … 4141 4289 4142 4290 g_object_unref (info->self); 4143 g_slice_free (PokeStatusInfo, info); 4291 4292 g_mutex_lock (info->mutex); 4293 g_cond_broadcast (info->condition); 4294 info->had_callback = TRUE; 4295 g_mutex_unlock (info->mutex); 4144 4296 } 4145 4297 … … 4179 4331 { 4180 4332 info->self = TNY_FOLDER (g_object_ref (folder)); 4333 4334 info->mutex = g_mutex_new (); 4335 info->condition = g_cond_new (); 4336 info->had_callback = FALSE; 4337 4181 4338 g_idle_add_full (G_PRIORITY_HIGH, 4182 4339 tny_camel_folder_poke_status_callback, 4183 4340 info, tny_camel_folder_poke_status_destroyer); 4184 } 4341 4342 4343 /* Wait on the queue for the mainloop callback to be finished */ 4344 g_mutex_lock (info->mutex); 4345 if (!info->had_callback) 4346 g_cond_wait (info->condition, info->mutex); 4347 g_mutex_unlock (info->mutex); 4348 4349 g_mutex_free (info->mutex); 4350 g_cond_free (info->condition); 4351 4352 g_slice_free (PokeStatusInfo, info); 4353 4354 } else if (info) 4355 g_slice_free (PokeStatusInfo, info); 4185 4356 4186 4357 /* Thread reference */ devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-store-account.c
r2513 r2521 1090 1090 TnyFolderStoreQuery *query; 1091 1091 gpointer user_data; 1092 guint depth; TnySessionCamel *session; 1092 guint depth; 1093 TnySessionCamel *session; 1094 1095 GCond* condition; 1096 gboolean had_callback; 1097 GMutex *mutex; 1098 1093 1099 } GetFoldersInfo; 1094 1100 … … 1108 1114 _tny_session_stop_operation (info->session); 1109 1115 1110 g_slice_free (GetFoldersInfo, info); 1116 1117 g_mutex_lock (info->mutex); 1118 g_cond_broadcast (info->condition); 1119 info->had_callback = TRUE; 1120 g_mutex_unlock (info->mutex); 1111 1121 1112 1122 return; … … 1140 1150 if (info->query) 1141 1151 g_object_unref (G_OBJECT (info->query)); 1152 1153 info->mutex = g_mutex_new (); 1154 info->condition = g_cond_new (); 1155 info->had_callback = FALSE; 1142 1156 1143 1157 if (info->callback) … … 1157 1171 } 1158 1172 1159 1173 /* Wait on the queue for the mainloop callback to be finished */ 1174 g_mutex_lock (info->mutex); 1175 if (!info->had_callback) 1176 g_cond_wait (info->condition, info->mutex); 1177 g_mutex_unlock (info->mutex); 1178 1179 g_mutex_free (info->mutex); 1180 g_cond_free (info->condition); 1181 1182 g_slice_free (GetFoldersInfo, info); 1160 1183 1161 1184 return NULL;
