Issue in DirectFB-GTK Port Event dispatch mechanism



Hi All,

We are currently involved in bringing up a multi-threaded graphics
abstraction layer on top of GTK-DFB. We are facing issues with the event
dispatch mechanism of GTK-DFB. On further analysis, we find that the
GTK-X11's event dispatch mechanism is a bit different from that of GTK-DFB.

The GTK-X11's event dispatch is thread safe i.e Please find below the
GTK-X11's event dispatch function code.

static gboolean
gdk_event_dispatch (GSource    *source,
		    GSourceFunc callback,
		    gpointer    user_data)
{
  GdkDisplay *display = ((GdkDisplaySource*)source)->display;
  GdkEvent *event;

 ------------> GDK_THREADS_ENTER ();<--------------

  _gdk_events_queue (display);
  event = _gdk_event_unqueue (display);

  if (event)
    {
      if (_gdk_event_func)
	(*_gdk_event_func) (event, _gdk_event_data);

      gdk_event_free (event);
    }

  ------------> GDK_THREADS_LEAVE ();<---------------

  return TRUE;
}

In comparison to this we find that GTK-DFB's event dispatch code is not
thread safe.

static void
dfb_events_dispatch (void)
{
  GdkDisplay *display = gdk_display_get_default ();
  GdkEvent   *event;

 ------------>" THREAD PROTECTION MISSING"<--------------

  while ((event = _gdk_event_unqueue (display)) != NULL)
    {
      if (_gdk_event_func)
        (*_gdk_event_func) (event, _gdk_event_data);

      gdk_event_free (event);
    }

 ------------>" THREAD PROTECTION MISSING"<--------------
}


It would be of great help for us if someone could throw some light on the
queries below.

1. Was this implementation of GTK-DFB's event dispatching made not thread
safe? If so what is the reason behind it?

2. How is the application expected to be designed for the GTK-DFB
environment?

3. Is it advisable to port a multi-threaded graphics abstraction layer on
top of GTK-DFB?

Regards,
Jerin



The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments contained in it.

Contact your Administrator for further information.


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