How to stop glib main loop mixing up perl loops

2017-03-16 Thread Mike Martin
*I have a weird issue on an application I am developing* *The application is fully tabbed and runs loops to transcode video files, and I would like to be able to run the main transcoding loop fully in parellel, ie: the process running in one tab is totally separate to that running in another tab*

Re: GDK + GLib main loop

2009-08-12 Thread Carlos Pereira
Mihai Draghicioiu wrote: I have found the way. Here is my code. Any idea where I can post it as a tutorial? Gtk Forums? they have a section specifically for Gtk example code: http://www.gtkforums.com/forum-15.html http://www.gtkforums.com/ Carlos #include stdlib.h #include glib.h #include

Re: GDK + GLib main loop

2009-08-12 Thread Mihai Draghicioiu
Not sure where on the wiki to post... any hints? On Wed, Aug 12, 2009 at 8:52 AM, Emmanuel Rodriguez emmanuel.rodrig...@gmail.com wrote: You can submit your code to be included with the examples of gtkglarea or use the GNOME wiki (http://live.gnome.org/). -- Emmanuel Rodriguez

Re: GDK + GLib main loop

2009-08-11 Thread Mihai Draghicioiu
I have found the way. Here is my code. Any idea where I can post it as a tutorial? #include stdlib.h #include glib.h #include gdk/gdk.h #include gdk/gdkgl.h #include GL/gl.h GdkGLWindow *glwin = NULL; GdkGLContext *glcontext = NULL; GMainLoop *mainloop; static void event_func(GdkEvent *ev,

Re: GDK + GLib main loop

2009-08-11 Thread Emmanuel Rodriguez
On Wed, Aug 12, 2009 at 5:09 AM, Mihai Draghicioiu mihai.draghici...@gmail.com wrote: I have found the way. Here is my code. Any idea where I can post it as a tutorial? You can submit your code to be included with the examples of gtkglarea or use the GNOME wiki (http://live.gnome.org/). --

GDK + GLib main loop

2009-07-22 Thread Mihai Draghicioiu
main loop. I have looked at the GLib main loop reference page, but I have no idea how to make the this work. So I need some hints here. And for the GDK_EXPOSE event thing, I even set the all events mask, and there was still no expose event. I went around this by drawing outside the event switch

GDK and GLib main loop

2009-07-22 Thread Mihai Draghicioiu
main loop. I have looked at the GLib main loop reference page, but I have no idea how to make the this work. So I need some hints here. And for the GDK_EXPOSE event thing, I even set the all events mask, and there was still no expose event. I went around this by drawing outside the event switch

Re: GDK + GLib main loop

2009-07-22 Thread Dov Grobgeld
the window does not receive an Expose event. I was told that for blocking until an event arrives, I'd have to use GLib main loop. I have looked at the GLib main loop reference page, but I have no idea how to make the this work. So I need some hints here. And for the GDK_EXPOSE event thing, I

Re: GDK + GLib main loop

2009-07-22 Thread Emmanuel Rodriguez
On Thu, Jul 23, 2009 at 5:33 AM, Mihai Draghicioiu mihai.draghici...@gmail.com wrote: Hi all! I'm making an OpenGL application based on GDK + GtkGLArea. My code so far works, but it has two issues: Do you really need to have your application based on GDK? Can't you use GTK instead? By using

Re: GDK + GLib main loop

2009-07-22 Thread Mihai Draghicioiu
I'd rather avoid the overhead of GTK+. My other choices were SDL and glut (and maybe others), but none of those offer the features of GDK (and GLib!). I have thought about using GTK+, and it's just pointless overhead, because I'm going to use my own (OpenGL-based) UI library. Besides, it's more

Re: GDK + GLib main loop

2009-07-22 Thread Emmanuel Rodriguez
On Thu, Jul 23, 2009 at 7:34 AM, Mihai Draghicioiu mihai.draghici...@gmail.com wrote: I'd rather avoid the overhead of GTK+. My other choices were SDL and glut (and maybe others), but none of those offer the features of GDK (and GLib!). I have thought about using GTK+, and it's just

Re: glib main loop without gtk

2008-11-13 Thread Alexander Semenov
Thomas Stover wrote: So if one wants to use g_io_channels with out gtk (console / server app), what exactly is the idea? Does glib need an initialization function called first? I see the g_main_loop_new() and friends functions, and that part make sense. The thing is g_io_add_watch_full() type

Re: glib main loop without gtk

2008-11-13 Thread Alexander Semenov
Alexander Semenov wrote: Thomas Stover wrote: So if one wants to use g_io_channels with out gtk (console / server app), what exactly is the idea? Does glib need an initialization function called first? I see the g_main_loop_new() and friends functions, and that part make sense. The thing is

Re: glib main loop without gtk

2008-11-13 Thread Emmanuele Bassi
On Wed, 2008-11-12 at 15:20 -0600, Thomas Stover wrote: So if one wants to use g_io_channels with out gtk (console / server app), what exactly is the idea? Does glib need an initialization function called first? only if you use GObject and the rest of the type system - in which case you'll

Re: glib main loop without gtk

2008-11-13 Thread Thomas Stover
First thanks to Alexander Semenov, and Emmanuele Bassi for your responses. It took some poking around, but I think get it now. Here is a concept demo for any future searches that find this thread. I'm not sure how to get out of the infinite loop though, since _iteration() returns both TRUE and

glib main loop without gtk

2008-11-12 Thread Thomas Stover
So if one wants to use g_io_channels with out gtk (console / server app), what exactly is the idea? Does glib need an initialization function called first? I see the g_main_loop_new() and friends functions, and that part make sense. The thing is g_io_add_watch_full() type functions don't have

Re: SwingWorker like interface in glib main loop?

2008-09-09 Thread [EMAIL PROTECTED]
in glib to run blocking code outside the glib main loop to prevent locking the gtk+ GUI? Do you guys know an easy solution like SwingWorker for glib? You can do non-blocking reads and writes with GIOChannel without having to start any new threads and it is not much more difficult than

Re: SwingWorker like interface in glib main loop?

2008-09-09 Thread Tor Lillqvist
Do you guys think a simple API like SwingWorker could be integrated in glib? Show us how the GLib API would look, and then if nobody opposes violently, volunteer to write the code and maintain it at least for one release cycle. Pointing at the Wikipedia page describing the Java API of

Re: SwingWorker like interface in glib main loop?

2008-09-09 Thread John Hobbs
You can do the open with http://library.gnome.org/devel/glib/stable/glib-IO-Channels.html#g-io-channel-new-file and you can do that async with the http://library.gnome.org/devel/glib/stable/glib-IO-Channels.html#g-io-channel-set-flags as Chris mentioned. - John On Tue, Sep 9, 2008 at 9:42 AM,

Re: SwingWorker like interface in glib main loop?

2008-09-09 Thread Chris Vine
On Tue, 9 Sep 2008 16:38:16 +0200 (MEST) [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: [snip] I would like to have a extremely simple API in glib for doing this kind of blocking calls as easily as possible. Do you guys think a simple API like SwingWorker could be integrated in glib? There

Re: SwingWorker like interface in glib main loop?

2008-09-09 Thread Thomas Dybdahl Ahle
man, 08 09 2008 kl. 23:16 +0200, skrev [EMAIL PROTECTED]: I just saw Havoc's blog entry SYNCHRONOUS IO NEVER OK: http://log.ometer.com/2008-09.html#7 and I wondered if there is a http://en.wikipedia.org/wiki/SwingWorker like interface in glib to run blocking code outside the glib main loop

Re: SwingWorker like interface in glib main loop?

2008-09-09 Thread [EMAIL PROTECTED]
John Hobbs wrote: You can do the open with http://library.gnome.org/devel/glib/stable/glib-IO-Channels.html#g-io-channel-new-file and you can do that async with the http://library.gnome.org/devel/glib/stable/glib-IO-Channels.html#g-io-channel-set-flags as Chris mentioned. I think you did not

SwingWorker like interface in glib main loop?

2008-09-08 Thread [EMAIL PROTECTED]
I just saw Havoc's blog entry SYNCHRONOUS IO NEVER OK: http://log.ometer.com/2008-09.html#7 and I wondered if there is a http://en.wikipedia.org/wiki/SwingWorker like interface in glib to run blocking code outside the glib main loop to prevent locking the gtk+ GUI? Do you guys know an easy

Re: SwingWorker like interface in glib main loop?

2008-09-08 Thread Chris Vine
outside the glib main loop to prevent locking the gtk+ GUI? Do you guys know an easy solution like SwingWorker for glib? You can do non-blocking reads and writes with GIOChannel without having to start any new threads and it is not much more difficult than blocking reads - you set it non

Re: glib main loop concept

2007-10-04 Thread Christian Buennig
Tristan Van Berkom wrote: On Thu, 2007-10-04 at 00:12 +0200, Christian Buennig wrote: [...] However, that does not matter any more. As suggested by you and jcupitt I'll avoid to autonomously run a main loop within the library. Note that in some contexts it makes sense to run a nested

Re: glib main loop concept

2007-10-04 Thread Donny Viszneki
Poor place to use the term context in casual parlance ;) On 10/4/07, Tristan Van Berkom [EMAIL PROTECTED] wrote: Note that in some contexts it makes sense to run a nested mainloop from a library if its safe to assume the app is already running a mainloop, an example of this is

Re: glib main loop concept

2007-10-03 Thread Christian Buennig
Hi, thanks for the hints, however, some more questions below.. Donny Viszneki wrote: I'm a bit of a newb to this, so others should feel free to correct me. On 10/2/07, Christian Buennig [EMAIL PROTECTED] wrote: Hi, I have a general question about the concepts of GLib main loops. I've

Re: glib main loop concept

2007-10-03 Thread jcupitt
On 10/2/07, Christian Buennig [EMAIL PROTECTED] wrote: * Do main loops exist per process or per thread? If I start a main loop in one thread (A) and add an IO watch in another thread (B), does this watch get added to the main loop of the thread A or B ? Each process can have one or more

Re: glib main loop concept

2007-10-03 Thread Christian Buennig
Thanks a lot! This makes things a bit more clear. One final question: Is it possible to detect if the default context currently has an active main loop? I want to add IO watches to the default context in a library. Apps using the library may decide to start a main loop themselves (in the default

Re: glib main loop concept

2007-10-03 Thread jcupitt
On 10/3/07, Christian Buennig [EMAIL PROTECTED] wrote: I want to add IO watches to the default context in a library. Apps using the library may decide to start a main loop themselves (in the default context) or to let the library do this. Of course they could tell the library somehow if there

Re: glib main loop concept

2007-10-03 Thread Donny Viszneki
not interact with the main loop from your library, let the application do that. If you want events such as your IO watches to reach into libraries you've loaded, have the libraries connect to the appropriate signals, and the glib main loop will do the rest. -- http://www.socsurveys.org/ http

Re: glib main loop concept

2007-10-03 Thread Donny Viszneki
Oh, I forgot this part: On 10/3/07, Christian Buennig [EMAIL PROTECTED] wrote: Of course they could tell the library somehow if there already is a running main loop in the default context, but it would be nice if the library could detect this itself.

Re: glib main loop concept

2007-10-03 Thread Christian Buennig
Donny Viszneki wrote: Oh, I forgot this part: On 10/3/07, Christian Buennig [EMAIL PROTECTED] wrote: Of course they could tell the library somehow if there already is a running main loop in the default context, but it would be nice if the library could detect this itself.

Re: glib main loop concept

2007-10-03 Thread Tristan Van Berkom
On Thu, 2007-10-04 at 00:12 +0200, Christian Buennig wrote: [...] However, that does not matter any more. As suggested by you and jcupitt I'll avoid to autonomously run a main loop within the library. Note that in some contexts it makes sense to run a nested mainloop from a library if its safe

glib main loop concept

2007-10-02 Thread Christian Buennig
Hi, I have a general question about the concepts of GLib main loops. I've read the GLib reference several times but still I don't get how main loops internally work. To be precisely, the following questions occur: * Do main loops exist per process or per thread? If I start a main loop in one

Re: Using GLib main loop to free up temporary memory

2007-01-04 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wed, Jan 03, 2007 at 01:02:39PM -0200, Leandro A. F. Pereira wrote: Greetings! [idle_free] Cute. But as Iago points out, you'll have to make sure that your app doesn't go into idle until the object is used. Tough call. I'd think it's more

Re: Using GLib main loop to free up temporary memory

2007-01-04 Thread Yeti
On Thu, Jan 04, 2007 at 02:00:14PM +, [EMAIL PROTECTED] wrote: Try alloca() if you are into that sort of thing. It's frowned upon, because it is a BSD extension... g_newa() should work on all platforms GLib works on. Yeti -- http://physics.muni.cz/~yeti/pf2007.png

Re: Using GLib main loop to free up temporary memory

2007-01-04 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, Jan 04, 2007 at 03:15:10PM +0100, David Nečas (Yeti) wrote: On Thu, Jan 04, 2007 at 02:00:14PM +, [EMAIL PROTECTED] wrote: Try alloca() if you are into that sort of thing. It's frowned upon, because it is a BSD extension...

Using GLib main loop to free up temporary memory

2007-01-03 Thread Leandro A. F. Pereira
); gchar *temp2 = g_strdup_printf(%s - %f, temp, G_PI); g_free(temp); return temp2; } Much better: temp won't leak anymore, but we had to use another variable. I propose a simpler solution, but it requires that your program runs in the GLib main loop. It should be used only on callback

Re: Using GLib main loop to free up temporary memory

2007-01-03 Thread Iago Rubio
. You can just do: gchar *func(void) { return g_strdup_printf(i am a temporary string - %f, G_PI); } Much better: temp won't leak anymore, but we had to use another variable. I propose a simpler solution, but it requires that your program runs in the GLib main loop. It should be used only

how do I plug this glib main loop memory leak?

2006-07-25 Thread Sebastian Kuzminsky
I'm not understanding something about the glib main loop and reference counting. I've got this trivial program that does nothing: - begin - #include signal.h #include stdio.h #include glib.h GMainLoop* main_loop = NULL; void signal_handler(int signo

Re: how do I plug this glib main loop memory leak?

2006-07-25 Thread Tristan Van Berkom
Sebastian Kuzminsky wrote: [...] The way I read this, g_main_loop_new() is allocating memory and not freeing it, even though I quit the loop and unref it. Clue in a helpless noob, what's going on here? The way I'm reading that trace, the g_main_loop_new() function when called the first

Glib Main Loop Query

2006-05-26 Thread Sumit Kumar Jain
Hello All, I have one quey about the function g_main_context_add_poll function. Once we add a file descriptor to be polled and if file descriptor is ready, how do we call a callback function for it. What i mean to say is if we use g_main_context_add_poll, where and how do we set the

Re: glib main loop

2002-08-29 Thread Lennart Poettering
On Thu, 29.08.02 01:09, Havoc Pennington ([EMAIL PROTECTED]) wrote: I believe if you create a custom source type with a check function that returns true if any of your other sources have run, such that it's dispatched if cleanup is needed, and then attach that source at a lower priority than

Re: glib main loop

2002-08-28 Thread Havoc Pennington
Lennart Poettering [EMAIL PROTECTED] writes: An example: I have a main context with four or five distinct attached sources. if any of these get triggered, some cleanup work is needed after their execution. If three of them are dispatched in an iteration i want to have my cleanup function