diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-12-21 01:58:09 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-12-21 01:58:09 +0800 |
commit | 538be0680e04babfa4a42132e8c6188c4b23efa2 (patch) | |
tree | c73a9f317d0c392fd397f68908d0a49e2398ae37 /calendar/gui/alarm-notify/alarm-notify.c | |
parent | c4edfbcd4477ae7e136537bf11d337da1c7ebfdb (diff) | |
download | gsoc2013-evolution-538be0680e04babfa4a42132e8c6188c4b23efa2.tar gsoc2013-evolution-538be0680e04babfa4a42132e8c6188c4b23efa2.tar.gz gsoc2013-evolution-538be0680e04babfa4a42132e8c6188c4b23efa2.tar.bz2 gsoc2013-evolution-538be0680e04babfa4a42132e8c6188c4b23efa2.tar.lz gsoc2013-evolution-538be0680e04babfa4a42132e8c6188c4b23efa2.tar.xz gsoc2013-evolution-538be0680e04babfa4a42132e8c6188c4b23efa2.tar.zst gsoc2013-evolution-538be0680e04babfa4a42132e8c6188c4b23efa2.zip |
** Fixes bug #362638
2007-12-20 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #362638
* calendar/gui/alarm-notify/alarm-notify.c:
* calendar/gui/alarm-notify/alarm-notify.h:
* calendar/gui/alarm-notify/alarm-queue.c:
Rewrite message passing to use GThreadPool instead of EThread.
* mail/mail-mt.h:
Overhaul the message passing API:
- Define a MailMsg type as the base message struct.
- Define types for the various callback functions.
- Add a priority value to each message (not yet used).
- Add a reference count to each message.
- Define a MailMsgInfo type for the virtual function table.
- Record the size of message sub-types in MailMsgInfo.
- New/changed functions:
mail_msg_new() - Easier to use.
mail_msg_ref() - Increase reference count.
mail_msg_unref() - Decrease reference count.
mail_msg_main_loop_push() }
mail_msg_unordered_push() } Submit MailMsgs to various
mail_msg_fast_ordered_push() } message-processing threads.
mail_msg_slow_ordered_push() }
* mail/mail-mt.c (mail_msg_new):
Use GSlice for memory allocation.
* mail/mail-mt.c (mail_msg_ref), (mail_msg_unref):
New functions increment/decrement a MailMsg's reference count.
* mail/mail-mt.c (mail_cancel_hood_add), (mail_cancel_hook_remove):
Convert the 'cancel_hook_list' from an EDList to a GHookList and
modify the API accordingly.
* mail/mail-mt.c:
Use GThreadPools instead of EThreads.
Use GAsyncQueues instead of EMsgPorts.
* mail/em-composer-utils.c:
* mail/em-folder-browser.c:
* mail/em-folder-properties.c:
* mail/em-folder-tree.c:
* mail/em-folder-utils.c:
* mail/em-folder-view.c:
* mail/em-format-html-print.c:
* mail/em-format-html.c:
* mail/em-subscribe-editor.c:
* mail/em-sync-stream.c:
* mail/importers/elm-importer.c:
* mail/importers/mail-importer.c:
* mail/importers/pine-importer.c:
* mail/mail-component.c:
* mail/mail-folder-cache.c:
* mail/mail-mt.c:
* mail/mail-ops.c:
* mail/mail-ops.h:
* mail/mail-send-recv.c:
* mail/mail-session.c:
* mail/mail-vfolder.c:
* mail/message-list.c:
* plugins/folder-unsubscribe/folder-unsubscribe.c:
* plugins/groupwise-features/share-folder-common.c:
* plugins/exchange-operations/exchange-folder.c:
* plugins/mark-all-read/mark-all-read.c:
* plugins/mailing-list-actions/mailing-list-actions.c:
* plugins/itip-formatter/itip-formatter.c:
* plugins/save-attachments/save-attachments.c:
Use the new MailMsg API for messages.
svn path=/trunk/; revision=34730
Diffstat (limited to 'calendar/gui/alarm-notify/alarm-notify.c')
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.c | 85 |
1 files changed, 4 insertions, 81 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 4d287c8cd2..570966ec14 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -45,10 +45,6 @@ struct _AlarmNotifyPrivate { GMutex *mutex; }; -EThread *alarm_operation_thread; /* for operations that can (or should) be queued */ -EMsgPort *alarm_reply_port; -static GIOChannel *alarm_reply_channel; - #define d(x) x @@ -286,72 +282,12 @@ alarm_notify_finalize (GObject *object) g_mutex_free (priv->mutex); g_free (priv); - e_thread_destroy(alarm_operation_thread); - g_io_channel_unref(alarm_reply_channel); - e_msgport_destroy(alarm_reply_port); if (G_OBJECT_CLASS (parent_class)->finalize) (* G_OBJECT_CLASS (parent_class)->finalize) (object); } -static guint -alarm_channel_setup(EMsgPort **port, GIOChannel **channel, GIOFunc func) -{ - GSource *source; - guint id; - - d (printf("%s:%d (alarm_channel_setup) - Channel Setup\n ", __FILE__, __LINE__)); - *port = e_msgport_new(); -#ifndef G_OS_WIN32 - *channel = g_io_channel_unix_new(e_msgport_fd(*port)); -#else - *channel = g_io_channel_win32_new_socket(e_msgport_fd(*port)); -#endif - source = g_io_create_watch(*channel, G_IO_IN); - g_source_set_callback(source, (GSourceFunc)func, *port, NULL); - g_source_set_can_recurse(source, FALSE); - id = g_source_attach(source, NULL); - g_source_unref(source); - - return id; -} - -static void -alarm_msg_destroy(EThread *e, EMsg *msg, void *data) -{ - AlarmMsg *m = (AlarmMsg *)msg; - - /* Free the private */ - g_free (m->data); /* Mostly it is a structure allocated as a carrier*/ - g_free (m); -} - -static gboolean -alarm_msgport_replied(GIOChannel *source, GIOCondition cond, void *d) -{ - EMsgPort *port = (EMsgPort *)d; - EMsg *m; - - while (( m = e_msgport_get(port))) { - d (printf("%s:%d (alarm_msgport_replied) - %p: Replied to GUI thread\n", __FILE__, __LINE__, m)); - alarm_msg_destroy(NULL, m, NULL); - } - - return TRUE; -} - -static void -alarm_msg_received(EThread *e, EMsg *msg, void *data) -{ - AlarmMsg *m = (AlarmMsg *)msg; - - d(printf("%s:%d (alarm_msg_received) - %p: Received at thread %" G_GINT64_MODIFIER "x\n", __FILE__, __LINE__, m, e_util_pthread_id(pthread_self()))); - if (m->receive_msg) { - m->receive_msg (e, m, data); - } -} - /** * alarm_notify_new: * @@ -363,23 +299,10 @@ alarm_msg_received(EThread *e, EMsg *msg, void *data) AlarmNotify * alarm_notify_new (void) { - AlarmNotify *an; - - d (printf("%s:%d (alarm_notify_new) - Alarm Notify New \n ", __FILE__, __LINE__)); - - /* Create a thread for alarm queue operation*/ - alarm_channel_setup(&alarm_reply_port, &alarm_reply_channel, alarm_msgport_replied); - - alarm_operation_thread = e_thread_new(E_THREAD_QUEUE); - e_thread_set_msg_destroy(alarm_operation_thread, alarm_msg_destroy, NULL); - e_thread_set_msg_received(alarm_operation_thread, alarm_msg_received, NULL); - e_thread_set_reply_port(alarm_operation_thread, alarm_reply_port); - - an = g_object_new (TYPE_ALARM_NOTIFY, - "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL), - NULL); - - return an; + return g_object_new (TYPE_ALARM_NOTIFY, + "poa", bonobo_poa_get_threaded ( + ORBIT_THREAD_HINT_PER_REQUEST, NULL), + NULL); } static void |