nanogui: Problems with flushing the request buffer
Subject:
Problems with flushing the request buffer
From:
Amadeus ####@####.####
Date:
10 Nov 2007 08:12:29 +0000
Message-Id: <200711100912.17347.amadeus@iksw-muees.de>
Hello All,
I have serious problems with flushing of the request buffer.
I am using uClinux and the PIXIL windowmanager. Shared memory support is
enabled.
In nxproto.c, there is the following piece of code:
> char c;
> nxShmCmdsFlushReq req;
>
> req.reqType = GrNumShmCmdsFlush;
> req.hilength = 0;
> req.length = sizeof(req);
> req.size = todo;
> req.reply = reply_needed;
>
> nxWriteSocket((char *)&req,sizeof(req));
>
> if ( reply_needed )
> while ( read(nxSocket, &c, 1) != 1 )
> ;
>
> reqbuf.bufptr = reqbuf.buffer;
the FLUSH command is sent to the server, and then there is a blocking
read until the server is sending the response (a single byte "1").
The problem is that there are situations when the socket interface is
not empty, but loaded with events from the server. The first byte of
the next event will be consumed by this code, and BOOM - the event
handling complains about wrong event types.
I have tried to cure this problem, but have not succeeded. This design
seems to be fishy and broken.
Is there a solution to this problem? And is it only me having this
problem? Any experience with shared memory support?
regards
Amadeus
--
We're back to the times when men were men
and wrote their own device drivers.
(Linus Torvalds)