Re: about two-way pipes or threads



In message <20010210152217 C2939 tux bitfreak net>you write:
>Hi there,
>
>I have tried a few things to do what I want. I already asked some questions
>on threading, on creating/using pipes, but I just cannot figure it out.
>
>What I want is to have control over another application. I need to write
>data to it's stdin and read it's stdout. I figured that using the "lower
>level pipes" would be nice here, but they don't work a bit. I get all kind
>of weird errors, output is only grabbed after the application has quitted.
>It is probably necessary to flush this applications output and/or flush my
>own grabbing of that output, but anyway, it didn't work (yet). Also, in
>some cases, I get xlib-async errors.

Given that I have at least 3 of my own applications and can name at
least half a dozen others that use this approach, I can safely say
that the only thing with whatever you're doing is is probably a
trivial error. This approach works perfectly, and any errors you are
getting are caused by some lac of understanding.

Why don't you send us a suitably stripped down version of the code,
and someone (me, or someone else) can comment on it.

>Internet says that xlib-async errors means that xlib is not thread-safe. So
>is it safe at all to use threads when I get this error as a result?

You won't get this error if you bracket all calls to X/GDK/GTK with

    gdk_threads_enter();
    ...
    gdk_threads_leave();

as the FAQ instructs.

--p




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