Re: How to send event to gtk main thread from another thread.



Tapan Satpathy Ansuman-A19108 wrote:
Hi,
I want to post event from another thread created using g_thread_create
function to the gtk_main loop.
Is there anyway to do so?

One very simple way to do it is to use g_idle_add.  Just do something like:

  static gboolean
  on_subthread_event (gpointer data)
  {
    // do something with gui
    return FALSE;
  }

    // in subthread
    ...
    g_idle_add (on_subthread_event, data);
    ...

--
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/



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