After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 456368 - New API for thawing object notify
New API for thawing object notify
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: gobject
2.13.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2007-07-12 19:58 UTC by Loïc Minier
Modified: 2007-07-13 07:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Loïc Minier 2007-07-12 19:58:02 UTC
Hi,

Victor Porton reported in Debian bug http://bugs.debian.org/222615:
"""
I am making essencially a GLib object which will save values of its
properties to a file.

To not write file (a time consuming operaqtion) several times when several
properties change in a row, it is reasobanle to write only at the time when
all g_object_freeze_notify() are undone by g_object_thaw_notify().

So we need a signal which woul be emitted on last g_object_thaw_notify().
Sadly in currentGlib there are no such signal.

Currently I'm going to work around this by using idle time handlers (or by
using my_object_{freeze,thaw}_notify(). But it is a hack. Please add this
signal.
"""

Do you think grouping of signals should be handled in special glib API?

Bye,
Comment 1 Tim Janik 2007-07-12 21:38:20 UTC
(In reply to comment #0)
> Hi,
> 
> Victor Porton reported in Debian bug http://bugs.debian.org/222615:
> """
> I am making essencially a GLib object which will save values of its
> properties to a file.
> 
> To not write file (a time consuming operaqtion) several times when several
> properties change in a row, it is reasobanle to write only at the time when
> all g_object_freeze_notify() are undone by g_object_thaw_notify().
> 
> So we need a signal which woul be emitted on last g_object_thaw_notify().
> Sadly in currentGlib there are no such signal.
> 
> Currently I'm going to work around this by using idle time handlers (or by
> using my_object_{freeze,thaw}_notify(). But it is a hack. Please add this
> signal.
> """
> 
> Do you think grouping of signals should be handled in special glib API?

thanks for forwarding the report. however, his approach of using an idle handler sounds perfectly suited to me, i'd actually have recommended it if he wouldn't use it already. the advantage of using an idler is that it can properly cope with common object state modification patterns such as (pseudo call stack):

+- main_loop
   +- idle_handler, saves object state
   +- event_dispatcher, modifies object state
      +- handler1
         +- freeze_notify
         +- modify property1
         +- modify property2 
         +- thaw_notify (emits notifies for property1, property2)
      +- handler1
         +- freeze_notify
         +- modify property3
         +- modify property4 
         +- thaw_notify (emits notifies for property3, property4)
   +- idle_handler, saves object state

under high loads, it might make sense to coalesce even multiple idle handlers (e.g. by using timeout handlers instead).

in any case, libgobject is very unlikely to gain an additional signal for freeze_notify. mainly because we already have a virtual function that can be used by derived object implementations to catch batch notifies and that feature proves to be allmost never used. the reason probably is, because the exact point in time where notifies are emitted is fairly arbitrary, considering that multiple functions in the call stack may freely issue freeze/thaw barriers and thus cause variying kinds of batch collections.

> 
> Bye,
> 
Comment 2 Loïc Minier 2007-07-13 07:23:50 UTC
Thanks for your very complete response; I've forwarded it to the submitter.