[comp.windows.x] Problem with XSync ?

amarger@irit.irit.fr (amarger) (01/10/91)

I'm working on a SUN4/OS4.0.3 X11R4/MOTIF1.1.
I want to synchronize a client with the server
So I'm using Xsync(), but it does not work.
Is the problem due to X11 or my source code???????

My source code:

   XSync ( dpy, False);
   evt_waiting = XPending ( dpy );
   while ( evt_waiting )
      {
      XtAppNextEvent ( App_ctxt, &evt );
      XtDispatchEvent ( &evt );
      XSync ( dpy, False );
      evt_waiting = XPending ( dpy );
   }
 

Normally, when I'm exiting the loop, all the requests sent to
the server, must have been treated by the server.
In fact, very often , that's not.
And if I wait a while, new events come from the server.
What's the matter ????

The problem occurs very often when server and client are on different 
machines (using an Xterm for example).
It's very uncommon when both are on the the same machine.

mouse@larry.mcrcim.mcgill.EDU (01/22/91)

>    XSync ( dpy, False);
>    evt_waiting = XPending ( dpy );
>    while ( evt_waiting )
>       {
>       XtAppNextEvent ( App_ctxt, &evt );
>       XtDispatchEvent ( &evt );
>       XSync ( dpy, False );
>       evt_waiting = XPending ( dpy );
>    }

> Normally, when I'm exiting the loop, all the requests sent to the
> server, must have been treated by the server.

True.  When XSync() returns, you know that all requests made have been
sent to the server and acted upon.

> In fact, very often , that's not.

Without more information about what makes you think this isn't true, I
can't say very much more.  All that comes to mind is that you're mixing
Xt code with Xlib code, which has bug potential (perhaps Xt has a
buffer of some sort that XSync doesn't know about and can't flush?).

> And if I wait a while, new events come from the server.

Well, of course.  Events can be generated asynchronously by user
actions (or other programs' actions).

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu