Re: discoveries! gtk DOES dim... how can i infinite-loop?

On Fri, Jan 20, 2012 at 8:12 AM, Gary Kline <kline thought org> wrote:
On Thu, Jan 19, 2012 at 11:18:22AM +0100, David Ne??as wrote:
Date: Thu, 19 Jan 2012 11:18:22 +0100
From: David Ne??as <yeti physics muni cz>
Subject: Re: discoveries! gtk DOES dim... how can i infinite-loop?
To: Gary Kline <kline thought org>
Cc: GTK Devel List <gtk-app-devel-list gnome org>

On Thu, Jan 19, 2012 at 12:58:09AM -0800, Gary Kline wrote:
i've spent the last many days tryoing [on ubuntu] anf tonight on my
EEE-900A netbook [debian].  both dim when i go into a recursive

1.  edit with gvim
2.  have espeak voice gvim when it is written
3 goto 1;

tonight i did everything absolutedly write in chercking various
things, but the app still dimd if i have the function call itselg.

i should have asked this list whether there there is  a gtk call
that let's things go into  either  an infinite loop, or, would a
for() loop work for 300-500 loops?

if not, i need to rethink my algorithm.

That is probably what you have to do.

If I understand what your code does (and how) then while gvim is running
your app is *not*.  Your app is blocked and waits until gvim terminates.
The same for espeak.

       i think you have it nailed!  [g]vim creates a .SWAP file in
       the pwd; so since gvim creates .talk.N.txt.swp while the
       textfile is being types into, i do a while(!done) check on
       the .swap file.  then i do a second while loop while
       talk.N.txt exists.  finally, espeak [flags] | aplay speaks
       the words in the text file.  [ i tee the output of espeak
       and hand it off to aplay because of strange driver bugs here
       on my desktop.]

You need to use a function such as g_spawn_async() to execute it.  Then
it depends how you communicate with the programs.  If you just want to
know when it terminates use waitpid().

       thanks much.  i'll check g_spawn_async() to see how it is
       used.  i hadn't thought of any of the flavors of wait;
       everything has worked: gvim//write-quit/espeak a dozen
       but the gtk app is greyed and the quit button doesn't work!

FWIW, we have g_child_watch_add() which is generally easier to
use than calling waitpid() directly (usually you don't want to
block on waitpid(), so you would have to handle the SIGCHLD unix
signal and then call waitpid() from the unix signal, which has
effectively pre-empted your process... since doing all of this
is much more complex than it needs to be, I highly recommend
using g_child_watch_add() to do this safely for you).




 Gary Kline  kline thought org  Public Service Unix
          Journey Toward the Dawn, E-Book:
         The 8.57a release of Jottings:
            Twenty-five years of service to the Unix community.

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

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