Re: g_main_depth()

On Sun, 29 Feb 2004, Owen Taylor wrote:

> I went ahead and added g_main_depth() - I decided to make it
> global rather than per GMainContext because:
>  - In the one use case we have, global seems equally good
>  - Global gives us a little more opportunity for future
>    performance enhancements ... e.g., using __thread variables
>    where available.
>  - Fractionally simpler to document and think about.

ok, i agree that's good enough.
two minor things:
- g_static_private_set (&depth_private, depth_pointer, g_free);
  wondering, is there really a scenariop where the location
  could ever be freed?
- the reentrancy scenario:
  * There is a temptation to use g_main_depth() to solve
  * problems with reentrancy. For instance, while waiting for data
  * to be received from the network in response to a menu item,
  * the menu item might be selected again. It might seem that
  * one could write:
  *   if (g_main_depth () > 1)
  *     return;
  it's not entirely clear to me what you mean here, i.e. where
  if (g_main_depth () > 1) return; would be inserted. so the docu
  should be improved a bit to explain the scenario better.

> Regards,
> 					Owen


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]