Xlib: unexpected async reply ?

Xlib: unexpected async reply ?

Post by Frederic Lorrai » Fri, 14 Apr 2000 04:00:00



Hello

I have a problem with Motif (under IRIX 6.5 but maybe not important) I
want to send output of functions to a window instead of the terminal.

So, I use a fork() to execute those functions in a child process. The
standard output of this child is a pipe read by the parent. The parent
waits for the messages from the child and puts it in a XmList.

But using a fork() seems to cause problems with XLib. If the child uses
popup windows to print some warnings, the parent is freezed or I get
some "Xlib: unexpected async reply" messages.

The reading of the pipe is correct, I believe that my problem comes from
the use of the fork() with Xlib ressources. Have you some ideas ?

here is some lines of my code:

The fonction to monit in a child :

void Galopin::OnMenuMakeProj(Widget w, XtPointer clientData, XtPointer
callData)
{
...
if ( ExecuteInChild() == True ) {                    
    LanceMakeProj();
    theApplication->terminate(0);
    }

Quote:}

The function ExecuteInChild() does the fork():

bool Galopin::ExecuteInChild()
{
    int p[2];
    char buf[101];
    int nbChar=0;

    pipe(p);

    switch( fork() ) {

        case 0: // in the child

            dup2(p[1],STDOUT_FILENO);

            close(p[0]);
            close(p[1]);

            return True;
//          break;

        default: // in the parent    

            close(p[1]);            

            do { // only to read the pipe, will be send to an interface
later
                memset(buf,0,101);
                int nbChar = read(p[0], buf, 100);
                printf("%s",buf);
               } while( nbChar );

            close(p[0]);

            return False;        
//          break;

        }

Quote:}

Regards

--
Fred

 
 
 

Xlib: unexpected async reply ?

Post by Rainer Nowag » Fri, 14 Apr 2000 04:00:00



> Hello

> I have a problem with Motif (under IRIX 6.5 but maybe not important) I
> want to send output of functions to a window instead of the terminal.

> So, I use a fork() to execute those functions in a child process. The
> standard output of this child is a pipe read by the parent. The parent
> waits for the messages from the child and puts it in a XmList.

> But using a fork() seems to cause problems with XLib. If the child uses
> popup windows to print some warnings, the parent is freezed or I get
> some "Xlib: unexpected async reply" messages.

> The reading of the pipe is correct, I believe that my problem comes from
> the use of the fork() with Xlib ressources. Have you some ideas ?

avoid using one connection in multiple processes. have the parent do all
the x stuff; the child can trigger warnings by sending keywords in the
pipe or some other IPC

BTW: comp.windows.x might be more helpful for such problems

--
Rainer

 
 
 

Xlib: unexpected async reply ?

Post by Frederic Lorrai » Sat, 15 Apr 2000 04:00:00



> avoid using one connection in multiple processes. have the parent do all
> the x stuff; the child can trigger warnings by sending keywords in the
> pipe or some other IPC

> BTW: comp.windows.x might be more helpful for such problems

All right, I will do that. It's better.
Thanks for the follow-up.

Regards

--
Fred

 
 
 

1. "Xlib: unexpected async reply" error.

Since we install patch (HP9000) to upgrade to Motif 1.2.2, this error occur
very often with my Motif applacation.

Do I need another patch??

Thanks

----------------------------------------------------------------------

--
--------------------------------------------------------------------------------
Stephane Proulx                                           Voice: (514)283-1153
Programmeur-Analyste                                        FAX: (514)283-1131
Mail: Cannot receive E-Mail (Router Config!!!)
--------------------------------------------------------------------------------

2. CDrecord

3. Xlib: unexpected async reply recieved

4. commercial security packages

5. GTK+ Error "Xlib: unexpected async reply (sequence 0xb9)!"

6. Probs with internet/lan conn. in rh6.0

7. unexpected async reply ?

8. Lilo troubles (tertiary IDE)

9. xlib: unexpected asynchronous reply?!

10. multiple threads and Xlib collision? async access problem

11. Qt-GL MultiThreaded Prog: error: Xlib: async

12. Xlib: sequence lost (0x12ddd > 0x2ddd) in reply type 0x2!

13. Problem adding tty port using 128 Port Async Adapter with 16 port Async Node